Pandas.Series.dtype.kind is None for pd.interval

余生长醉 提交于 2019-12-11 12:39:39

问题


Test code:

s = pd.Series(pd.array([pd.Interval(0,1.2), pd.Interval(5,123)]))
s.dtype
s.dtype.kind is None

>>> interval[float64]
>>> True

Is it some bug or made intentionally? If latter - for what reason?


回答1:


The reason this is appearing as None is simply because the implementation of IntervalDtype explicitly sets kind = None. This should probably be updated to 'O', though some care is needed here as it will result in unintended side effects, e.g. this would cause is_string_dtype to return True (see here).



来源:https://stackoverflow.com/questions/56384938/pandas-series-dtype-kind-is-none-for-pd-interval

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!