Skip to content

Tag: pandas

Loop through a few commands using a function

I have a loop where I constantly got an error message. I want to loop them through a function. So far I have: How can I number the df and let the df go through 1, 2, 3, 4 (like df1, df2 df3) Answer col is a variable. ‘col’ is a string. Having df[‘col’] doesn’t refer to the variab…

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…