Skip to content

Tag: pandas

Error while concatenating date and time columns in pandas

I have a data frame with the following properties: Date column has values as format : 2021-11-28 00:00:00 and Time column has values as format: 08:15:12.476000. I am trying to create a DateTime column with the following code (basically tried most of the available pandas’ methods like to_datetime, to_tim…

How to filter a column by the last characters in Python

I have a column with a string similar to country string_num Botswana 864-0-0 Germany 968-0-5 Thailand 684-1-0 I would like to filter out all the strings that end with the numbers-0-0 and get a full data set view of rest. I have tried the following code: The code runs, but I still see the rows that end with -0…

dictionary inside column of a dataframe

I have a pandas dataframe that has a column like this : I want to make a condition on the whole dataframe based on the id value. I did many attempts but failed. it says key error, it cannot access ‘id’ which is inside the column ‘platform’. Any help is welcome, and thank you in advance…

Python Pivoting dataframe that has mulitple ID columns

from a database I get the following table into a python dataframe df: FunctionID FunctionText FunctionModule UserGroup 1 Fct1 ModX GroupA 2 Fct2 ModX GroupA 2 Fct2 ModX GroupB 3 Fct3 ModY GroupB 3 Fct3 ModY GroupC . … … … 3000 Fct3000 ModZ GroupF My goal is to get a pivot-like table that loo…