Skip to content

implement tslibs.arraylike #21700

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

Closed
wants to merge 3 commits into from

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@@ -37,6 +37,9 @@ from cython cimport Py_ssize_t
import pytz
UTC = pytz.utc

from tslibs.arraylike import ( # noqa:F841
format_array_from_datetime, array_to_datetime, array_with_unit_to_datetime,
Copy link
Contributor

Choose a reason for hiding this comment

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

isn’t the point to not import back here, rather import directly to where it’s needed

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. For the first pass I like to keep the diff small, but now I'll update.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually on second thought there are a lot of usages of these I'd rather not update. I think the thing to do is leave this where it is for now and put it in the tslibs namespace a few PRs from now when we finish transitioning tslib

@codecov
Copy link

codecov bot commented Jul 1, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21700   +/-   ##
=======================================
  Coverage    91.9%    91.9%           
=======================================
  Files         154      154           
  Lines       49659    49659           
=======================================
  Hits        45640    45640           
  Misses       4019     4019
Flag Coverage Δ
#multiple 90.28% <ø> (ø) ⬆️
#single 41.89% <ø> (ø) ⬆️

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 ad76ffc...6248438. Read the comment docs.


cimport numpy as cnp
from numpy cimport int64_t, ndarray, float64_t
import numpy as np
Copy link
Contributor

Choose a reason for hiding this comment

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

so some of this should be put in conversion. or is there a reason you are not doing that? i would like to shy away from creating a new module unless it has a clear purpose. can you move what is logical first.

Copy link
Member Author

Choose a reason for hiding this comment

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

so some of this should be put in conversion. or is there a reason you are not doing that?

Three broad reasons.

  1. the dependency graph. Nothing else in tslibs relies on these functions, so I'd like to keep them away from the "low-level" code (recall before tslibs was created there was just one giant file and it was a pain to tell what depended on what).

    1b) The original scope for conversion was convert_to_tsobject and the minimal set of functions that uses. There has been a little drift from there but its still recognizable. We should keep it that way.

  2. array_to_datetime does things slightly (and annoyingly) differently from the constructors in conversion, so I prefer to keep them separate until the array_to_datetime behavior is changed so they can share code.

  3. conversion is 1180 lines ATM which is near the high end of ideal IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I guess my general comment is that I would like to logically group routines. not sure if all of this should be moved to a new single file (e.g. maybe they logicall belong in different modules). I haven't looked in detail.

all +1 for removing from tslibs.pyx. I think the hangup is that arraylike is not very descriptive (and conversions.pyx is). maybe a better name would help.

@jreback jreback added Datetime Datetime data dtype Clean labels Jul 2, 2018
@@ -0,0 +1,717 @@
# -*- coding: utf-8 -*-

Copy link
Member

Choose a reason for hiding this comment

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

if you end up creating this file, can you take the opportunity of the refactor to add a module docstring here to better document what / what type of functionality is included in this file?

But I agree with Jeff that from a quick view some of those functions seems to be about parsing / conversion?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add a docstring. See comment above about scope.

@jbrockmendel
Copy link
Member Author

Part of this PR is superseded by #21721. The other part is in limbo. Closing to clear the queue.

@jbrockmendel
Copy link
Member Author

Woops, closed the wrong one.

@jbrockmendel jbrockmendel reopened this Jul 4, 2018
@jbrockmendel
Copy link
Member Author

Closing as non-actionable for now

@jbrockmendel jbrockmendel deleted the arraylike branch July 11, 2018 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants