Skip to content

Tag: dataframe

How do I separate measurement value and unit into their respective columns if they appear together in DataFrame?

I have a DataFrame which contains measurements; e.g., weight, height, etc. However, sometimes the measurement column contains units together with values. Therefore, I would like to separate measurement values and units if they are together in DataFrame. Eg., In the below DataFrame, df, the height value and unit of the first entry are in respective columns. However, the value column

Convert nested dict to dataframe, syntax error?

Problem I am converting multiple nested dicts to dataframes. I have a slightly different dict that I haven’t been able to convert to a dataframe using my attempted solution. I am providing a shortened copy of my dict with dummy values as the reprex. Reprex dict: My attempted solution Code is based on similar dict wrangling problems that I had,

Join two columns of sequentially values

I have dataframe, where ‘A’ 1 – client, B – admin I need to merge messages in row with 1 sequentially and merge lines 2 – admin response sequentially across the dataframe. I do not know how to do this Answer Create groups by consecutive values in B – trick compare shifted values with cumulative sum and aggregate first and