chained-assignment

Adding new column to existing DataFrame in Python pandas

牧云@^-^@ 提交于 2019-11-25 23:59:09
问题 I have the following indexed DataFrame with named columns and rows not- continuous numbers: a b c d 2 0.671399 0.101208 -0.181532 0.241273 3 0.446172 -0.243316 0.051767 1.577318 5 0.614758 0.075793 -0.451460 -0.012493 I would like to add a new column, \'e\' , to the existing data frame and do not want to change anything in the data frame (i.e., the new column always has the same length as the DataFrame). 0 -0.335485 1 -1.166658 2 -0.385571 dtype: float64 I tried different versions of join ,

How to deal with SettingWithCopyWarning in Pandas?

空扰寡人 提交于 2019-11-25 21:34:01
问题 Background I just upgraded my Pandas from 0.11 to 0.13.0rc1. Now, the application is popping out many new warnings. One of them like this: E:\\FinReporter\\FM_EXT.py:449: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_index,col_indexer] = value instead quote_df[\'TVol\'] = quote_df[\'TVol\']/TVOL_SCALE I want to know what exactly it means? Do I need to change something? How should I suspend the warning if I insist to use quote_df[