Skip to content

datetime64 bug arising in Series.set_value #1561

@wesm

Description

@wesm

from the mailing list

Hi guys,
I am using the new release 0.8.0. Below is what I observed. My numpy
version if 1.6.2. Please help. thx.

In [3]: from pandas import Series

In [4]: from datetime import datetime

In [5]: s = Series().set_value(datetime(2001,1,1),
1.).set_value(datetime(2001,1,2),float('nan'))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/yihao/YH_Backups/YH_Work/lyh/gss/python/gss_main/<ipython-input-5-5c2e9c89865a>
in <module>()
----> 1 s = Series().set_value(datetime(2001,1,1),
1.).set_value(datetime(2001,1,2),float('nan'))

/usr/local/lib/python2.7/dist-packages/pandas/core/series.pyc in
set_value(self, label, value)
    741             return self
    742         except KeyError:
--> 743             new_index = np.concatenate([self.index.values, [label]])
    744             new_values = np.concatenate([self.values, [value]])
    745             return Series(new_values, index=new_index, name=self.name)

TypeError: invalid type promotion

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions