Skip to content
Advertisement

Tag: dataframe

Pandas string concatenation of row values of a column that have an implicit hierarchy

I have a dataframe signifying the temperature for three days for different regions in India. It’s given in the following image. original_dataframe I need to generate another column in the same dataframe that concatenates the string values of the state and the city which is seen in ‘Col5’ as per the below image. output_dataframe I’m aware of merging the values

Minimum value for each row in pandas dataframe

im trying to compute the minimum for each row in a pandas dataframe. I would like to add a column that calculates the minimum values and ignores “NaN” and “WD” For example should give me a new column like I tried df.where(df > 0).min(axis=1) and df.where(df != “NaN”).min(axis=1) without success Answer Convert values to numeric with non numeric to NaNs

Advertisement