Skip to content

CLN: removed unused import #32518

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 2 commits into from
Mar 12, 2020

Conversation

ShaharNaveh
Copy link
Member

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

Not 100% sure about this, can close anytime if not a good PR

@ShaharNaveh
Copy link
Member Author

I also benched marked it:

master:

In [1]: import pandas as pd                                                                                   

In [2]: %timeit pd.Period("2000-01-01", freq="D")                                                             
165 µs ± 777 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

PR:

In [1]: import pandas as pd                                                                                   

In [2]: %timeit pd.Period("2000-01-01", freq="D")                                                             
166 µs ± 449 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

from cpython.datetime cimport (datetime, date,
PyDateTime_IMPORT,
PyDateTime_GET_YEAR, PyDateTime_GET_MONTH,
PyDateTime_GET_DAY, PyDateTime_DATE_GET_HOUR,
Copy link
Member

Choose a reason for hiding this comment

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

i find the year-month-day-hour-minute-second ordering clearer than the alphabetical ordering. its not worth bikeshedding, which is why id discourage these for the most part

also makes it harder to see what the actual removed imports are (datetime and date, right?). That part im on board with.

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 find the year-month-day-hour-minute-second ordering clearer than the alphabetical ordering. its not worth bikeshedding, which is why id discourage these for the most part

Agreed, I have no idea how to enforce it with isort

also makes it harder to see what the actual removed imports are (datetime and date, right?). That part im on board with.

Correct, that's why I did it in two commits and not in one, as you an see after the removal of the unused imports what is left looks pretty ugly, so I figured I run isort on that specific import block.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Lgtm

@datapythonista
Copy link
Member

Why is isort not complaining with the original code? Is it validating that file?

@ShaharNaveh
Copy link
Member Author

Why is isort not complaining with the original code? Is it validating that file?

@datapythonista isort is not checking that file ATM, in the release of isort 5.0.0 it will begin to support .pyx files.

I think you ment flake8, and I don't know why it's not catching it (or if it's even checking.pyx files)

@WillAyd
Copy link
Member

WillAyd commented Mar 12, 2020

@datapythonista @jbrockmendel any outstanding objections?

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

lgtm

@jbrockmendel
Copy link
Member

lgtm

@datapythonista datapythonista merged commit 05925d2 into pandas-dev:master Mar 12, 2020
@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Mar 12, 2020
@ShaharNaveh ShaharNaveh deleted the CLN-unused-import branch March 14, 2020 14:06
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants