Skip to content

BUG: series resample with timedelta values looses dtype (GH13119) #14118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2016

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche added Bug Resample resample method labels Aug 29, 2016
@jorisvandenbossche jorisvandenbossche added this to the 0.19.0 milestone Aug 29, 2016
@@ -89,7 +89,8 @@ def trans(x): # noqa

if issubclass(dtype.type, np.floating):
return result.astype(dtype)
elif dtype == np.bool_ or issubclass(dtype.type, np.integer):
elif (dtype == np.bool_ or issubclass(dtype.type, np.integer) and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change these to use is_bool_dtype and such (iow thr pandas intro spectors)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, this probably solves the timedelta problem at once as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to be careful about timedeltas because they are represented as integers, so new to be clear which dtype you have (and don't mix); this is more of an in general statement (not necessarily relevant to this particular question)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue in this case was exactly something like that: a timedelta dtype passed the issubclass(dtype.type, np.integer) check, and for this reason the specific elif close for datetimes and timedeltas more below at line 128 was not used for timedeltas (but was correct for datetimes).

@codecov-io
Copy link

codecov-io commented Aug 29, 2016

Current coverage is 85.27% (diff: 100%)

Merging #14118 into master will increase coverage by <.01%

@@             master     #14118   diff @@
==========================================
  Files           139        139          
  Lines         50511      50511          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43071      43072     +1   
+ Misses         7440       7439     -1   
  Partials          0          0          

Powered by Codecov. Last update 10bf721...c06ac1e

@jorisvandenbossche jorisvandenbossche merged commit 0c1e052 into pandas-dev:master Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Resample resample method
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: resample with datetime64 data on series looses dtype
3 participants