Relative Content

Tag Archive for pandasdataframerename

Moving values in pandas df to new column within df, rename column based on str in column

I have a pandas df of data stripped from a pdf. I have already done some considerable wrangling to get it to this point. There are about 100 chemical concentrations at about 10 sites, and in separate rows, a lab note for each of them denoting info from the tests corresponding to each site. I would like to add the unit (various units) into the column name and move the lab note (a,b,c,d,e in example, vary in my data) into the row for its respective location. Please see image below.