8000 BUG/TST/REF: Datetimelike Arithmetic Methods by jbrockmendel · Pull Request #23215 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

8000 BUG/TST/REF: Datetimelike Arithmetic Methods #23215

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 49 commits into from
Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
dc2280f
Make arithmetic code dispatch less redundant, fix datetime64 addition…
jbrockmendel Oct 17, 2018
37728ff
remove unnecessary nat_new
jbrockmendel Oct 17, 2018
15ad0a6
Fix interpretation of NaT
jbrockmendel Oct 17, 2018
94f1745
move test
jbrockmendel Oct 17, 2018
bf5e2fb
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 17, 2018
3bdf104
whatsnew, fix dropped timezone
jbrockmendel Oct 17, 2018
982ea30
remove comment
jbrockmendel Oct 17, 2018
d046038
Add GH references
jbrockmendel Oct 17, 2018
a0c1a85
remove unused imports
jbrockmendel Oct 18, 2018
33d82b3
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 18, 2018
8a7c249
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 18, 2018
8e57fd8
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 18, 2018
b932121
dummy commit to force CI
jbrockmendel Oct 18, 2018
9f3b18d
Fix bug in adding DateOffset to PeriodIndex, Series, Frame
jbrockmendel Oct 19, 2018
7a8232e
Dummy commit to force CI
jbrockmendel Oct 19, 2018
a743f74
revert tracebackhide
jbrockmendel Oct 19, 2018
0693196
Merge branch 'arith' of https://github.com/jbrockmendel/pandas into a…
jbrockmendel Oct 19, 2018
29d91af
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 19, 2018
af4872e
comment and reversion
jbrockmendel Oct 19, 2018
6707032
revert to simpler version
jbrockmendel Oct 20, 2018
18ef26d
Move overriding of addsub_int_array to PeriodArray
jbrockmendel Oct 20, 2018
60f7f8d
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 23, 2018
9372423
correct docstrings
jbrockmendel Oct 23, 2018
2a6268e
comments and assertions
jbrockmendel Oct 23, 2018
777f4d9
More explicit names for array/scalar add/sub methods
jbrockmendel Oct 23, 2018
ee885c8
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 23, 2018
5f231b2
oo optimization fixup
jbrockmendel Oct 23, 2018
0214a9e
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 23, 2018
fbee9f5
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 24, 2018
f7cf3d9
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 24, 2018
d799d8e
Dummy commit to force CI
jbrockmendel Oct 25, 2018
82df39c
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 25, 2018
8cf614b
change default fill_value for maybe_mask_results
jbrockmendel Oct 25, 2018
a45734a
Merge branch 'arith' of https://github.com/jbrockmendel/pandas into a…
jbrockmendel Oct 25, 2018
fb007cb
Make docstring extra explicit
jbrockmendel Oct 25, 2018
1d3fd48
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 25, 2018
aecfef7
prettify docstrings
jbrockmendel Oct 25, 2018
dade955
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 26, 2018
a6eb01c
fixup super usage
jbrockmendel Oct 26, 2018
acf1f74
flesh out TODO comment
jbrockmendel Oct 26, 2018
e89e3ef
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 26, 2018
d306277
move test for moved method
jbrockmendel Oct 26, 2018
f6e4073
Fixup name
jbrockmendel Oct 26, 2018
9146a72
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 27, 2018
4e4b9ed
change NotImplementedError to TypeError
jbrockmendel Oct 27, 2018
f35b3b6
Fix add_delta_tdi return type; docstrings
jbrockmendel Oct 27, 2018
87e07ef
Merge branch 'arith' of https://github.com/jbrockmendel/pandas into a…
jbrockmendel Oct 27, 2018
343ee30
Merge branch 'master' of https://github.com/pandas-dev/pandas into arith
jbrockmendel Oct 28, 2018
0466b9c
docstring edit, rename
jbrockmendel Oct 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
comment and reversion
  • Loading branch information
jbrockmendel committed Oct 19, 2018
commit af4872ea9b472684d76621e6779bd6b3104af8cc
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _add_offset(self, offset):
def _add_delta(self, other):
"""
Add a timedelta-like, Tick or TimedeltaIndex-like object
to self.
to self, yielding another array of the same type

Parameters
----------
Expand Down
10 changes: 9 additions & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,15 @@ def _sub_datelike(self, other):
@Appender(dtl.DatetimeLikeArrayMixin._add_delta.__doc__)
def _add_delta(self, delta):
new_values = dtl.DatetimeLikeArrayMixin._add_delta(self, delta)
return type(self)(new_values, tz=self.tz, freq='infer')

# Note: this construction is _not_ equivalent to
# type(self)(new_values, tz=self.tz, freq'infer'')
# see GH#23215
tz = 'UTC' if self.tz is not None else None
result = type(self)(new_values, tz=tz, freq='infer')
if self.tz is not None and self.tz is not utc:
result = result.tz_convert(self.tz)
return result

# -----------------------------------------------------------------
# Timezone Conversion and Localization Methods
Expand Down
0