0

This my code to create a new column with a calculation in a data frame

df1['Cases/Tests/1M pop']= (df1['Tot Cases/1M pop']/ df1['Tests/ 1M pop'])*100

and I got this error message in the output

settingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
 df1['Cases/Tests/1M pop']= (df1['Tot Cases/1M pop']/ df1['Tests/ 1M pop'])*100

0 Answers0