-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Cant access some TimedeltaProperties
components directly
#33255
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
Comments
s.dt.seconds is not equal to s.dt.components.seconds. what is the expected behaviour here? |
Oh, I though it was equal, I'll edit the original post.
I guess the expected behavior here, is the ability to access every component directly though
I think I should have the ability to access all of the components and not just |
As @simonjayhawkins noted, the top-level attributes and the component attributes are not the same.
The behaviour of the So See the note here: https://pandas.pydata.org/pandas-docs/stable/user_guide/timedeltas.html#attributes |
@jorisvandenbossche Thank you for the detailed explanation! So from what I understand there is no bug, because there is no |
Yes, this is all expected as I can see. |
@jorisvandenbossche I made a PR (#33259) giving examples for the field assessors, I only added examples for the |
Closing as there is no actual issue/bug |
XREF: #33208 (comment)
Note:
I'm using "hours" here for the examples, but this applies to
Short explanation:
Not all components are exposed directly:
Example:
Long explanation:
If we create a series that contains a timedelta, we can access only some of the components directly.
Example setup:
We can access "days" and "seconds" directly, for example:
But if we try to access "hours" for example directly:
Output of
pd.show_versions()
:INSTALLED VERSIONS
commit : 37dc5dc
python : 3.7.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.5.13.a-1-hardened
Version : #1 SMP PREEMPT Wed, 25 Mar 2020 21:46:24 +0000
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.0.dev0+1089.g37dc5dc39
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.0.0.post20200311
Cython : 0.29.16
pytest : 5.4.1
hypothesis : 5.8.0
sphinx : 2.4.4
blosc : None
feather : None
xlsxwriter : 1.2.8
lxml.etree : 4.5.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.13.0
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.2
fastparquet : 0.3.3
gcsfs : None
matplotlib : 3.2.1
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.1
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.4.1
sqlalchemy : 1.3.15
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.15.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.48.0
The text was updated successfully, but these errors were encountered: