对于pd.interval,Pandas.Series.dtype.kind为None [英] Pandas.Series.dtype.kind is None for pd.interval

查看:140
本文介绍了对于pd.interval,Pandas.Series.dtype.kind为None的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

测试代码:

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?

推荐答案

之所以显示为None的原因仅仅是因为IntervalDtype的实现此处).

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).

这篇关于对于pd.interval,Pandas.Series.dtype.kind为None的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆