In [26]: xyz = temp_val_ns.join(temp_ref_ns, how='outer')
Traceback (most recent call last):
File "<ipython-input-26-e10ed4b1946b>", line 1, in <module>
xyz = temp_val_ns.join(temp_ref_ns, how='outer')
File "C:\Anaconda\lib\site-packages\pandas\core\frame.py", line 3867, in join
rsuffix=rsuffix, sort=sort)
File "C:\Anaconda\lib\site-packages\pandas\core\frame.py", line 3881, in _join_compat
suffixes=(lsuffix, rsuffix), sort=sort)
File "C:\Anaconda\lib\site-packages\pandas\tools\merge.py", line 39, in merge
return op.get_result()
File "C:\Anaconda\lib\site-packages\pandas\tools\merge.py", line 187, in get_result
join_index, left_indexer, right_indexer = self._get_join_info()
File "C:\Anaconda\lib\site-packages\pandas\tools\merge.py", line 260, in _get_join_info
left_ax.join(right_ax, how=self.how, return_indexers=True)
File "C:\Anaconda\lib\site-packages\pandas\core\index.py", line 1729, in join
elif self.is_monotonic and other.is_monotonic:
File "C:\Anaconda\lib\site-packages\pandas\core\index.py", line 577, in is_monotonic
return self._engine.is_monotonic_increasing
AttributeError: 'pandas.index.Int64Engine' object has no attribute 'is_monotonic_increasing'
我在0.15中没有任何问题,因此它可能与this change有关。只是好奇是否有人有类似的问题,如果有一个解决方法。提前谢谢。
编辑:添加可重复的示例。
aaa = {'bbot_sampler_ref': {1413180063086001221: True,
1413180063086915835: True,
1413180063086998237: True,
1413180063087746824: True,
1413180063089530483: True},
'bw_ref': {1413180063086001221: 128.04550264550264,
1413180063086915835: 128.04553191489362,
1413180063086998237: 128.04559139784948,
1413180063087746824: 128.04556756756756,
1413180063089530483: 128.04492822966506}}
temp_ref_ns = pd.DataFrame(aaa)
bbb = {
'agg': {1413180063080171210: 1,
1413180063080280537: 1,
1413180063080365279: 1,
1413180063080440876: 1,
1413180063080514973: 1},
'last_trade': {1413180063080171210: 150.75,
1413180063080280537: 150.75,
1413180063080365279: 150.75,
1413180063080440876: 150.75,
1413180063080514973: 150.75},
'mid': {1413180063080171210: 150.745,
1413180063080280537: 150.745,
1413180063080365279: 150.745,
1413180063080440876: 150.745,
1413180063080514973: 150.745},
'pcap_seq': {1413180063080171210: 17613,
1413180063080280537: 17615,
1413180063080365279: 17617,
1413180063080440876: 17619,
1413180063080514973: 17621},
'timestamp': {1413180063080171210: 1413180063080171210,
1413180063080280537: 1413180063080280537,
1413180063080365279: 1413180063080365279,
1413180063080440876: 1413180063080440876,
1413180063080514973: 1413180063080514973}}
temp_val_ns = pd.DataFrame(bbb)
然后,这将失败并出现上述错误:
xyz = temp_val_ns.join(temp_ref_ns, how='outer')
答案 0 :(得分:0)
在0.15.1为我工作。您收到的错误可能是因为您更新了源但未重新编译(如果您手动安装了代码),因为名为is_monotonic_increasing
的函数是0.15中的新功能0.1。
In [11]: temp_ref_ns
Out[11]:
bbot_sampler_ref bw_ref
1413180063086001221 True 128.045503
1413180063086915835 True 128.045532
1413180063086998237 True 128.045591
1413180063087746824 True 128.045568
1413180063089530483 True 128.044928
In [12]: temp_val_ns
Out[12]:
agg last_trade mid pcap_seq timestamp
1413180063080171210 1 150.75 150.745 17613 1413180063080171210
1413180063080280537 1 150.75 150.745 17615 1413180063080280537
1413180063080365279 1 150.75 150.745 17617 1413180063080365279
1413180063080440876 1 150.75 150.745 17619 1413180063080440876
1413180063080514973 1 150.75 150.745 17621 1413180063080514973
In [13]: temp_val_ns.join(temp_ref_ns, how='outer')
Out[13]:
agg last_trade mid pcap_seq timestamp bbot_sampler_ref bw_ref
1413180063080171210 1 150.75 150.745 17613 1.413180e+18 NaN NaN
1413180063080280537 1 150.75 150.745 17615 1.413180e+18 NaN NaN
1413180063080365279 1 150.75 150.745 17617 1.413180e+18 NaN NaN
1413180063080440876 1 150.75 150.745 17619 1.413180e+18 NaN NaN
1413180063080514973 1 150.75 150.745 17621 1.413180e+18 NaN NaN
1413180063086001221 NaN NaN NaN NaN NaN True 128.045503
1413180063086915835 NaN NaN NaN NaN NaN True 128.045532
1413180063086998237 NaN NaN NaN NaN NaN True 128.045591
1413180063087746824 NaN NaN NaN NaN NaN True 128.045568
1413180063089530483 NaN NaN NaN NaN NaN True 128.044928