Skip to content
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

BUG: pd.Series.dt.end_time when values are pd.Period objects are producing different results #17157

Closed
pirsquared opened this issue Aug 2, 2017 · 3 comments · Fixed by #18952
Labels
Milestone

Comments

@pirsquared
Copy link

pirsquared commented Aug 2, 2017

From this SO post

Code Sample, a copy-pastable example if possible

import pandas as pd

s = pd.Series(pd.to_datetime(['2010-08-05']))
sp = s.dt.to_period('M')
sp.iloc[0].end_time == sp.dt.end_time.iloc[0]

Problem description

In the above code, I compare two ways in which I expected to get the same exact value. It seems that when I use sp.dt.end_time I get the final date of the period but with time set to zeros. If I use sp.iloc[0].end_time I get what I expected, which is the final date and time set to '23:59:59.999999999'

Expected Output

True

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.6.0.final.0
python-bits: 64
OS: Darwin
OS-release: 16.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.20.3
pytest: 3.0.5
pip: 9.0.1
setuptools: 36.2.0
Cython: 0.25.2
numpy: 1.13.1
scipy: 0.18.1
xarray: 0.9.5
IPython: 5.1.0
sphinx: 1.5.1
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: 1.2.0
tables: 3.3.0
numexpr: 2.6.1
feather: 0.4.0
matplotlib: 2.0.0
openpyxl: 2.4.1
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.2
bs4: 4.5.3
html5lib: 0.9999999
sqlalchemy: 1.1.5
pymysql: None
psycopg2: None
jinja2: 2.9.4
s3fs: None
pandas_gbq: None
pandas_datareader: 0.4.0

@chris-b1
Copy link
Contributor

chris-b1 commented Aug 2, 2017

Yeah that is inconsistent. Two conflicting bits of logic are:

def end_time(self):

(scalar)


(array)

xref #9089 proposal there was to change the scalar behavior

@chris-b1 chris-b1 added API Design Period Period data type labels Aug 2, 2017
@jreback
Copy link
Contributor

jreback commented Aug 3, 2017

the .dt accessor version is wrong here.

@jreback
Copy link
Contributor

jreback commented Aug 3, 2017

pull requests welcome!

@jreback jreback modified the milestones: Next Major Release, 0.21.0 Aug 3, 2017
@jreback jreback changed the title pd.Series.dt.end_time when values are pd.Period objects are producing different results BUG: pd.Series.dt.end_time when values are pd.Period objects are producing different results Aug 3, 2017
@jreback jreback modified the milestones: Next Major Release, 0.23.0 Mar 13, 2018
@jreback jreback modified the milestones: 0.23.0, Next Major Release Apr 14, 2018
@jreback jreback modified the milestones: Contributions Welcome, 0.24.0 Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants