我正在使用熊猫 0.8.1
创建一个非空数据框:
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
这是不对的,是吗?