Skip to content
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

Refactor out libwriters, fix references to Timestamp, Timedelta #19413

Merged
merged 11 commits into from
Feb 1, 2018

Conversation

jbrockmendel
Copy link
Member

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

@codecov
Copy link

codecov bot commented Jan 26, 2018

Codecov Report

Merging #19413 into master will increase coverage by 0.02%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #19413      +/-   ##
==========================================
+ Coverage    91.6%   91.62%   +0.02%     
==========================================
  Files         150      150              
  Lines       48724    48725       +1     
==========================================
+ Hits        44632    44645      +13     
+ Misses       4092     4080      -12
Flag Coverage Δ
#multiple 89.99% <86.36%> (+0.02%) ⬆️
#single 41.74% <63.63%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/computation/scope.py 93.13% <ø> (ø) ⬆️
pandas/io/json/normalize.py 96.87% <100%> (ø) ⬆️
pandas/io/parsers.py 95.49% <100%> (ø) ⬆️
pandas/core/resample.py 96.43% <100%> (ø) ⬆️
pandas/core/internals.py 95.47% <100%> (ø) ⬆️
pandas/io/formats/format.py 96.24% <100%> (ø) ⬆️
pandas/plotting/_converter.py 66.95% <100%> (+1.73%) ⬆️
pandas/core/nanops.py 96.69% <100%> (ø) ⬆️
pandas/core/dtypes/cast.py 87.98% <100%> (ø) ⬆️
pandas/core/generic.py 95.91% <50%> (ø) ⬆️
... and 2 more

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 65639e6...16d3a57. Read the comment docs.

return arr


def convert_timestamps(ndarray values):
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than just move this, replace it with something like (where its called)
pd.to_datetime(arr, cache=True).to_pydatetime()

Copy link
Member Author

Choose a reason for hiding this comment

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

Works for me.



@cython.wraparound(False)
@cython.boundscheck(False)
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than copy this, replace with pd.unique()

bytes


def sanitize_objects(ndarray[object] values, set na_values,
Copy link
Contributor

Choose a reason for hiding this comment

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

move this to parsers.pyx

@jreback jreback added Output-Formatting __repr__ of pandas objects, to_string Clean labels Jan 27, 2018

def sanitize_objects(ndarray[object] values, set na_values,
convert_empty=True):
cdef:
Copy link
Contributor

Choose a reason for hiding this comment

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

can u add a doc string

def write_csv_rows(list data, ndarray data_index,
int nlevels, ndarray cols, object writer):

cdef int N, j, i, ncols
Copy link
Contributor

Choose a reason for hiding this comment

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

can u add some doc strings

@@ -4621,7 +4622,7 @@ def _get_converter(kind, encoding):
if kind == 'datetime64':
return lambda x: np.asarray(x, dtype='M8[ns]')
elif kind == 'datetime':
Copy link
Contributor

Choose a reason for hiding this comment

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

this branch might not even be hit anymore
can u point to where it is exercised?

Copy link
Member Author

Choose a reason for hiding this comment

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

It'll be reached if IndexCol.convert is called with an IndexCol of kind == 'datetime'.

Copy link
Contributor

Choose a reason for hiding this comment

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

i can read what if says (i wrote this)
what i am asking is which test hits this
this inference should not be true except for an object Index which infers to datetime which we rarely have (as they are always converts)

Copy link
Member Author

Choose a reason for hiding this comment

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

Then I have no idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove this kind == 'datetime' branch its not hit by anything

@@ -4621,7 +4622,7 @@ def _get_converter(kind, encoding):
if kind == 'datetime64':
return lambda x: np.asarray(x, dtype='M8[ns]')
elif kind == 'datetime':
Copy link
Contributor

Choose a reason for hiding this comment

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

i can read what if says (i wrote this)
what i am asking is which test hits this
this inference should not be true except for an object Index which infers to datetime which we rarely have (as they are always converts)

@@ -4621,7 +4622,7 @@ def _get_converter(kind, encoding):
if kind == 'datetime64':
return lambda x: np.asarray(x, dtype='M8[ns]')
elif kind == 'datetime':
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove this kind == 'datetime' branch its not hit by anything

@jbrockmendel
Copy link
Member Author

you can remove this kind == 'datetime' branch its not hit by anything

OK. What about the other places where kind == 'datetime'?

@jreback
Copy link
Contributor

jreback commented Jan 31, 2018

u might be able to remove them as well

@jbrockmendel
Copy link
Member Author

My inclination is to not mess with parts of the code I'm not familiar with.

@jreback jreback added this to the 0.23.0 milestone Jan 31, 2018
@jreback
Copy link
Contributor

jreback commented Jan 31, 2018

lgtm. I reverted the last commit, will do in #19475 . ping on green.

@jbrockmendel
Copy link
Member Author

Ping

@jreback jreback merged commit 4eb0cec into pandas-dev:master Feb 1, 2018
@jreback
Copy link
Contributor

jreback commented Feb 1, 2018

thanks!

@jbrockmendel jbrockmendel deleted the libwriters branch February 11, 2018 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants