Skip to content
Advertisement

Tag: dataframe

Python/Pandas:How to process a column of data like a dictionary

i have a csv lie this i would like to sum the values from column “PDCP.RxBytesUl”, PDCP.RxBytesUl = 5QI1+5QI2+5QI3+5QI4+5QI5+5QI6+5QI7+5QI8+5QI9 finally,the result is like this At first I wanted to convert this column into a dict(), but I found the format was not right, i have no idea, please help me, thank you Answer You can use Regex based solution: df:

How to downcast numeric columns in Pandas?

How to optimize the data frame memory footprint and find the most optimal (minimal) data types dtypes for numeric columns. For example: Expected result: Answer You can use parameter downcast in to_numeric with selectig integers and floats columns by DataFrame.select_dtypes, it working from pandas 0.19+ like mentioned @anurag, thank you:

Advertisement