Skip to content

CLN: pytables _set_tz/_get_tz #30018

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 4 commits into from
Dec 4, 2019

Conversation

jbrockmendel
Copy link
Member

removes preserve_UTC argument, which never did anything, and didnt have a clear purpose

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

looks good generally

values: Union[np.ndarray, Index],
tz: Optional[Union[str, tzinfo]],
coerce: bool = False,
):
Copy link
Member

Choose a reason for hiding this comment

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

Is the return easy to annotate here? DTI or Ndarray?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, will do

coerce : if we do not have a passed timezone, coerce to M8[ns] ndarray
"""
if isinstance(values, DatetimeIndex):
# If we values is tzaware, the tz gets dropped in the values.ravel()
Copy link
Member

Choose a reason for hiding this comment

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

Is we a typo?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@WillAyd WillAyd added the Clean label Dec 4, 2019
@jreback jreback added this to the 1.0 milestone Dec 4, 2019
# call below (which returns an ndarray). So we are only non-lossy
# if `tz` matches `values.tz`.
assert values.tz is None or values.tz == tz

if tz is not None:
name = getattr(values, "name", None)
values = values.ravel()
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we need the ravel any longer

Copy link
Member Author

Choose a reason for hiding this comment

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

i havent checked if we ever actually pass 2D ndarray, but the ravel is definitely needed in the case where we have a DTI (or we would have to replace it with DTI-specific code) (see the comment a few lines up)

@jreback jreback added the IO HDF5 read_hdf, HDFStore label Dec 4, 2019
@jbrockmendel
Copy link
Member Author

updated per comments

BTW thanks @jreback and @WillAyd for putting up with the deluge of PRs in this file. I think once the statefulness issues are addressed it will become much more maintainable long-term

@jreback jreback merged commit fb547b4 into pandas-dev:master Dec 4, 2019
@jreback
Copy link
Contributor

jreback commented Dec 4, 2019

ok sure

@jbrockmendel jbrockmendel deleted the cln-pytables-set_tz branch December 4, 2019 19:16
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean IO HDF5 read_hdf, HDFStore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants