paste a vector to a filtered data frame pandas
Publicado por Juan Carlos (16 intervenciones) el 10/05/2021 12:52:26
I'm struggling with the following code line:
BusinessAZ[(BusinessAZ['county']=='Na') | (BusinessAZ['county']=='error code')].loc[:,'county'] = counties
what I trying to do is to paste a vector ('counties') to a filtered data frame, but I get the following error:
C:\Users\Juan Carlos\anaconda3\lib\site-packages\pandas\core\indexing.py:1745: 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 isetter(ilocs[0], value)
enter image description here
And also I'm not getting the desired output (which is pasting each of the vector 'counties' to a new row called 'county' in the data frame 'BusinessAZ').
Does anyone know how to solve this problem.
I would really appreciate if you can help me.
Kinds regards
Juan C
BusinessAZ[(BusinessAZ['county']=='Na') | (BusinessAZ['county']=='error code')].loc[:,'county'] = counties
what I trying to do is to paste a vector ('counties') to a filtered data frame, but I get the following error:
C:\Users\Juan Carlos\anaconda3\lib\site-packages\pandas\core\indexing.py:1745: 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 isetter(ilocs[0], value)
enter image description here
And also I'm not getting the desired output (which is pasting each of the vector 'counties' to a new row called 'county' in the data frame 'BusinessAZ').
Does anyone know how to solve this problem.
I would really appreciate if you can help me.
Kinds regards
Juan C
Valora esta pregunta


0