Skip to content

Conversation

@jbrockmendel
Copy link
Member

Removes an unnecessary call to frequencies.to_offset, one of the last few non-cython dependencies in the file.

will post asv results when available.

def _add_delta(self, other):
if isinstance(other, (timedelta, np.timedelta64, offsets.Tick)):
offset = frequencies.to_offset(self.freq.rule_code)
if isinstance(offset, offsets.Tick):
Copy link
Member Author

Choose a reason for hiding this comment

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

This along with the line above is redundant; isinstance(offset, offsets.Tick) if and only if isinstance(self.freq, offsets.Tick).

@codecov
Copy link

codecov bot commented Jun 13, 2018

Codecov Report

Merging #21447 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21447   +/-   ##
=======================================
  Coverage   91.89%   91.89%           
=======================================
  Files         153      153           
  Lines       49604    49604           
=======================================
  Hits        45584    45584           
  Misses       4020     4020
Flag Coverage Δ
#multiple 90.29% <ø> (ø) ⬆️
#single 41.88% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf1c3dc...a3d11c6. Read the comment docs.

@gfyoung gfyoung added Datetime Datetime data dtype Performance Memory or execution speed performance labels Jun 13, 2018
@gfyoung
Copy link
Member

gfyoung commented Jun 13, 2018

will post asv results when available.

@jbrockmendel : whatsnew entry in 0.24.0 + perf test would also be good here.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

  • @gfyoung comments. (just see if we have an asv, you can run them and run report and significant diffs)

msg = 'Input cannot be converted to Period(freq={0})'
raise IncompatibleFrequency(msg.format(self.freqstr))
elif isinstance(other, offsets.DateOffset):
elif getattr(other, "_typ", None) == "dateoffset":
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe should add an is_offset_object in util.pxd

Copy link
Contributor

Choose a reason for hiding this comment

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

can you do this

@jreback jreback added this to the 0.24.0 milestone Jun 13, 2018
@jbrockmendel
Copy link
Member Author

as isn't showing much (recall it is wonky on my machine for reasons unknown)

taskset 6 asv continuous -f 1.1 -E virtualenv master HEAD -b period
[...]
    before     after       ratio
  [defdb34b] [daf9aaf7]
-    3.26ms     2.82ms      0.87  period.PeriodIndexConstructor.time_from_pydatetime('D')

    before     after       ratio
  [defdb34b] [daf9aaf7]
+   87.34ms   147.38ms      1.69  gil.ParallelDatetimeFields.time_datetime_to_period
+  118.47ms   133.50ms      1.13  gil.ParallelDatetimeFields.time_period_to_datetime
+   35.94ms    39.66ms      1.10  period.DataFramePeriodColumn.time_setitem_period_column
-   66.75μs    60.54μs      0.91  period.PeriodProperties.time_property('min', 'start_time')
-   75.69μs    68.21μs      0.90  period.PeriodProperties.time_property('M', 'end_time')

    before     after       ratio
  [defdb34b] [daf9aaf7]
+  884.44ns     1.00μs      1.13  period.PeriodProperties.time_property('min', 'week')
-  143.83ms   116.09ms      0.81  gil.ParallelDatetimeFields.time_period_to_datetime
-  143.24ms    93.98ms      0.66  gil.ParallelDatetimeFields.time_datetime_to_period

    before     after       ratio
  [defdb34b] [daf9aaf7]
+  123.27ms   164.93ms      1.34  gil.ParallelDatetimeFields.time_period_to_datetime
-   19.73μs    17.71μs      0.90  period.PeriodUnaryMethods.time_asfreq('M')
-    1.03μs   879.73ns      0.85  period.PeriodProperties.time_property('M', 'is_leap_year')

    before     after       ratio
  [defdb34b] [daf9aaf7]
+  112.56ms   125.62ms      1.12  gil.ParallelDatetimeFields.time_datetime_to_period
-   40.44ms    36.20ms      0.89  period.DataFramePeriodColumn.time_setitem_period_column

msg = 'Input cannot be converted to Period(freq={0})'
raise IncompatibleFrequency(msg.format(self.freqstr))
elif isinstance(other, offsets.DateOffset):
elif getattr(other, "_typ", None) == "dateoffset":
Copy link
Contributor

Choose a reason for hiding this comment

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

can you do this

@jreback jreback merged commit c50a9dc into pandas-dev:master Jun 15, 2018
@jreback
Copy link
Contributor

jreback commented Jun 15, 2018

thanks!

david-liu-brattle-1 pushed a commit to david-liu-brattle-1/pandas that referenced this pull request Jun 18, 2018
@jbrockmendel jbrockmendel deleted the cymisc branch June 22, 2018 03:27
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Datetime Datetime data dtype Performance Memory or execution speed performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants