大家好,我在使用pandas做数据处理时想要对缺失进行处理,根据不同的情况缺失赋予不同的值,如下
source Fact_amount income amount_rate
143360 **车贷中心 11333.333330 NaN NaN
143361 **车贷中心 56666.666670 NaN NaN
以下代码
for i in range(0,143364):
if math.isnan(df.loc[i].income):
df.ix[i].income=d[df.ix[i].source[0:2]]
但是在循环内修改数据时就会报错
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation--大神们救我~
http://www.jb51.net/article/63603.htm
df.ix[i]是数据的拷贝,不修改原数据的
兄弟 你太他妈搞笑了.
See the caveats in the documentation--大神们救我~See the caveats in the documentation--大神们救我~See the caveats in the documentation--大神们救我~See the caveats in the documentation--大神们救我~
哈哈哈哈 , 套路