pandas.Series.add中参数fill_value一些理解

本文探讨了在数据处理中遇到的NaN值如何通过填充特定值进行管理,并详细解释了两个数组在经过NaN值处理后的相加运算过程。对于缺失值,采用NaN作为替代,确保数据的一致性和运算的准确性。

个人猜测这个值是把a和b中value=NaN的值都变成fill_value,然后a和b相同索引的value相加,缺失值用NaN代替

试输入:add —— 预期输出 —— True —— 实际输出 —— Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2566, in get_value return libts.get_value_box(s, key) File "pandas/_libs/tslib.pyx", line 1017, in pandas._libs.tslib.get_value_box File "pandas/_libs/tslib.pyx", line 1025, in pandas._libs.tslib.get_value_box TypeError: 'str' object cannot be interpreted as an integer During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test6/test_pandas_6.py", line 16, in <module> test_pandas1() File "test6/test_pandas_6.py", line 11, in test_pandas1 if(int(a.ix[0]['e'])==8): File "/usr/local/lib/python3.6/site-packages/pandas/core/series.py", line 623, in __getitem__ result = self.index.get_value(self, key) File "/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2574, in get_value raise e1 File "/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2560, in get_value tz=getattr(series.dtype, 'tz', None)) File "pandas/_libs/index.pyx", line 83, in pandas._libs.index.IndexEngine.get_value File "pandas/_libs/index.pyx", line 91, in pandas._libs.index.IndexEngine.get_value File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'e'
06-16
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值