I have a pandas dataframe in which I want to divide each column by the same data series values for each row. Each column and the data series have the same length. The data series has only float numbers but some cells in the dataframe have NaNs.
I tried various things but somehow I cannot get it solved.
df = df.divide(data_series, axis=1)
Any suggestions?
many thanks!
I found the solution
Setting axis = 0 solves the issue.
df = df.divide(data_series, axis=0 )
many thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With