0

I am not expecing nan value; how I can solve this error?

UNITS = {"KG/HA":1, "L/HA":1, "G/HA":0.001, "ML/100KG":0.001, "G/L":0.001}
i = df["DOSAGE"]
u = df["DOSAGE_UNIT"]
df['NEW'] = i.map(UNITS) * u
#print(df.head())
df = df['NEW']
print(df)
df = pd.DataFrame(df)

Output:

0        NaN
1        NaN
3        NaN
4        NaN
6        NaN
        ... 
24287    NaN
24288    NaN
24289    NaN
24290    NaN
24291    NaN
Name: NEW, Length: 19243, dtype: object)
Leonardo
  • 2,439
  • 33
  • 17
  • 31
George
  • 13
  • 5

1 Answers1

0
df['NEW']=i * u.map(UNITS) #it works
George
  • 13
  • 5
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 05 '22 at 12:59