neveneleven
neveneleven

Reputation: 9

NaN output when multiplying row and column of dataframe in pandas

I have two data frames the first one looks like this: first data frame

and the second one like so: second data frame

I am trying to multiply the values in number of donors column of the second data frame(96 values) with the values in the first row of the first data frame and columns 0-95 (also 96 values).

Below is the code I have for multiplying the two right now, but as you can see the values are all NaN:

code

Does anyone know how to fix this?

Upvotes: 0

Views: 256

Answers (1)

voldr
voldr

Reputation: 392

Your second dataframe has dtype object, you must convert it to float

df_sls.iloc[0,3:-1].astype(float)

Upvotes: 1

Related Questions