0

Bonjour, I don't understand this warning.

print(data_france_malade.head(4))
date deces guerisons
0 2020-02-21 1.0 NaN
1 2020-02-22 1.0 NaN
2 2020-02-23 1.0 NaN
3 2020-02-24 1.0 NaN
data_france_malade.loc[0,'guerisons'] = 0

''' C:\Users\David\anaconda3\lib\site-packages\pandas\core\indexing.py:1817: 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:

self._setitem_single_column(loc, value, pi)

with '''

data_france_malade['guerisons'][0] = 0.0

'''This is the same. ''' Do you have any explanation? What solution is?

enter link description here

Regards,

Atapalou
  • 21
  • 2
  • At some point _before_ this provided code you have unsafely subset your DataFrame. Either `data_france_malade = df[cols]` or `data_france_malade = df[mask]` when it should have been `data_france_malade = df[cols].copy()` or `data_france_malade = df[mask].copy()` – Henry Ecker Mar 11 '22 at 15:48

0 Answers0