我正在使用pandas 0.8.1
创建非空DataFrame:
import pandas
blah = pandas.DataFrame(numpy.empty([1, 1]), columns=['A'], index=pandas.DatetimeIndex(['2008-01-01']))
blah[numpy.array([true], bool)]
A
2008-01-01 0
blah[numpy.array([True], bool)] = 0.0
这一切都很好,但在空的情况下:
blah = pandas.DataFrame(numpy.empty([0, 1]), columns=['A'], index=pandas.DatetimeIndex([]))
blah[numpy.array([], bool)]
Empty DataFrame
...
blah[numpy.array([], bool)] = 0.0
Traceback (most recent call last):
...
IndexError: invalid index
那不对,是吗?