-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: is_scalar returns True for DateOffset objects #18982
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18982 +/- ##
=======================================
Coverage 91.58% 91.58%
=======================================
Files 150 150
Lines 48967 48967
=======================================
Hits 44846 44846
Misses 4121 4121
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.23.0.txt
Outdated
@@ -144,6 +144,7 @@ Other Enhancements | |||
- :class:`Interval` and :class:`IntervalIndex` have gained a ``length`` attribute (:issue:`18789`) | |||
- ``Resampler`` objects now have a functioning :attr:`~pandas.core.resample.Resampler.pipe` method. | |||
Previously, calls to ``pipe`` were diverted to the ``mean`` method (:issue:`17905`). | |||
- :func:`is_scalar` now returns True for DateOffset objects (:issue:`18943`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- :func:`is_scalar` --> :func:`~pandas.api.types.is_scalar`
- True --> ``True``
- DateOffset --> ``DateOffset``
pandas/_libs/lib.pyx
Outdated
|
||
""" | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this white space?
Thanks! It looks like the test for pandas/pandas/tests/dtypes/test_inference.py Lines 1150 to 1153 in 4883a43
Might be nice to add an assert statement for Interval in addition to DateOffset , since it should also return True but appears to be untested.
Not 100% sure about your other questions, so I'll let someone else field those instead of potentially saying something that's not right. |
Thanks. I should be more clear about the "is" stuff, here is the wildcard import: pandas/pandas/core/dtypes/common.py Lines 16 to 17 in 4883a43
which I don't think conforms to PEP 8 (?). Just wondering if it's there for a reason or if I should go through and only explicitly export the necessary functions. Also quick noobie question: when I make changes to pandas locally, I've been running |
Excessively messed around with rebasing just now, sorry about that! |
@gitavi you don't need to rebase. we squash on merge. |
thanks @gitavi |
the what I would like to change though is to rename |
git diff upstream/master -u -- "*.py" | flake8 --diff
I've implemented
is_offset
identically tois_period_object
and added it toisscalar
andis_scalar
is now returning true for DateOffsets.But not sure how to go about this exactly:
The other "is" functions that are explicitly imported from inference
is_string_like
andis_list_like
are used for testing but don't look like they themselves are being tested so I'm not sure what kind of test is needed. The rest of the "is" functions are imported with a wildcard but pylint is telling me they are not used (should I go through and make the required imports explicit?).