Skip to content

BUG: need better inference for path in Series construction #9456

Closed
@jreback

Description

@jreback

This hits a path in Series.__init__ which I think needs some better inference

https://github.com/pydata/pandas/blob/master/pandas/core/series.py#L178

In [1]: d = {numpy.datetime64('2015-01-07T02:00:00.000000000+0200'): 42544017.198965244,
   ...:      numpy.datetime64('2015-01-08T02:00:00.000000000+0200'): 40512335.181958228,
   ...:      numpy.datetime64('2015-01-09T02:00:00.000000000+0200'): 39712952.781494237,
   ...:      numpy.datetime64('2015-01-12T02:00:00.000000000+0200'): 39002721.453793451}

In [2]: Series(d)
Out[2]: 
2015-01-07   NaN
2015-01-08   NaN
2015-01-09   NaN
2015-01-12   NaN
dtype: float64

In [3]: Series(d.values(),d.keys())
Out[3]: 
2015-01-07    42544017.198965
2015-01-08    40512335.181958
2015-01-09    39712952.781494
2015-01-12    39002721.453793
dtype: float64

The problem is the index is already converted at this point and its not easy to get the keys/values out (except to do so explicity which is better IMHO).

Need a review of what currently hits this path (can simply put a halt in here and see what tests hit this). Then figure out a better method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions