最新的pandas 0.20.2 TimedeltaIndex.join方法没有采取' sort = ...' kwarg,因此它不能用作pandas / core / reshape / merge.py第722行所需的连接索引。这里是如何重现:
import pandas as pd
import numpy as np
tx = pd.timedelta_range('09:30:00', '10:00:00', freq='30s')
df0 = pd.DataFrame(np.random.randn(len(tx), 3), index=tx, columns=['a','b','c'])
df1 = pd.DataFrame(np.random.randn(len(tx), 2), index=tx, columns=['d','e'])
df0.join(df1)
抛出异常:
/opt/anaconda/lib/python2.7/site-packages/pandas/core/reshape/merge.pyc in _get_join_info(self) 720 join_index, left_indexer, right_indexer = \ 721 left_ax.join(right_ax, how=self.how, return_indexers=True, --> 722 sort=self.sort) 723 elif self.right_index and self.how == 'left': 724 join_index, left_indexer, right_indexer = \ TypeError: join() got an unexpected keyword argument 'sort'
版本0.19.2正常工作。 这是一个错误还是别的什么?