Tag: pandas

如何处理Pandas中的SettingWithCopyWarning?

背景 我只是把我的pandas从0.11升级到了0.13.0rc1。 现在,应用程序正在popup很多新的警告。 其中之一是这样的: 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 我想知道究竟是什么意思? 我需要改变一些东西吗? 如果我坚持使用quote_df['TVol'] = quote_df['TVol']/TVOL_SCALE应该如何暂停警告? 提供错误的function def _decode_stock_quote(list_of_150_stk_str): """decode the webpage and return dataframe""" from cStringIO import StringIO str_of_all = "".join(list_of_150_stk_str) quote_df = pd.read_csv(StringIO(str_of_all), […]