Skip to content

REF: Fuse all the types #23022

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 15 commits into from
Oct 17, 2018
Merged

REF: Fuse all the types #23022

merged 15 commits into from
Oct 17, 2018

Conversation

jbrockmendel
Copy link
Member

Everything is passing locally, just want to run this through the CI for good measure before continuing down this path.

@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

@@ -1153,7 +1153,7 @@ def check_int_bool(self, inplace):
inplace=inplace, limit=limit,
fill_value=fill_value,
coerce=coerce,
downcast=downcast, mgr=mgr)
Copy link
Member Author

Choose a reason for hiding this comment

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

Edits here are unrelated, should be removed from this PR.

int64_t lab

N, K = (<object> values).shape
accum = np.empty_like(values)
accum.fill({{inf_val}})
if groupby_t is int64_t:
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 make this more generic ? she what if we expand this to other int types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Presumably. The MO with these PRs is to keep the logic unchanged.

I think there is also a cost in compile-time.

Copy link
Contributor

Choose a reason for hiding this comment

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

this is a small cost of compile time (actually maybe nothing as cython is pretty smart). but i suppose can handle later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough. Easy to implement if/when its actually needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

see some comments above

@codecov
Copy link

codecov bot commented Oct 7, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #23022   +/-   ##
=======================================
  Coverage   92.19%   92.19%           
=======================================
  Files         169      169           
  Lines       50959    50959           
=======================================
  Hits        46980    46980           
  Misses       3979     3979
Flag Coverage Δ
#multiple 90.61% <ø> (ø) ⬆️
#single 42.29% <ø> (ø) ⬆️

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 913f71f...400e708. Read the comment docs.

@gfyoung gfyoung added Refactor Internal refactoring of code Internals Related to non-user accessible pandas implementation labels Oct 7, 2018
@jbrockmendel
Copy link
Member Author

Just pushed, moving some more functions over. I think I should stop here for this PR before the diff gets out of hand.

Made a bug report to cython about a mysterious failure.

@jbrockmendel jbrockmendel changed the title WIP: Fuse all the types REF: Fuse all the types Oct 10, 2018
@jbrockmendel
Copy link
Member Author

Thoughts here?

ndarray[int64_t] indexer, Py_ssize_t loc,
ndarray[{{dest_type2}}] out):
def put2d_{{name}}_{{dest_type[:-2]}}(ndarray[{{c_type}}, ndim=2, cast=True] values,
ndarray[int64_t] indexer, Py_ssize_t loc,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a it obtuse can u make it more explicit (the slice)

@@ -638,7 +623,12 @@ def group_max_{{name}}(ndarray[{{dest_type2}}, ndim=2] out,
nobs = np.zeros_like(out)

maxx = np.empty_like(out)
maxx.fill(-{{inf_val}})
if groupby_t is int64_t:
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 comment / add a Todo here

maxx[lab, j] = val
else:
if val == val and val != nan_val:
nobs[lab, j] += 1
Copy link
Contributor

Choose a reason for hiding this comment

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

we should have a function that does the null comparisons though with the template code it is slightly
tricky, maybe have a suite of isna_int, isna_float functions

Copy link
Member Author

Choose a reason for hiding this comment

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

we should have a function that does the null comparisons though with the template code

I've been thinking about something similar, will give it a go in the next pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

k

else:
out[i, j] = maxx[i, j]


group_max_float64 = group_max["float64_t"]
group_max_float32 = group_max["float32_t"]
group_max_int64 = group_max["int64_t"]
Copy link
Contributor

Choose a reason for hiding this comment

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

we DO need to expand these to all int/unit dtypes
FYI

int64_t lab

N, K = (<object> values).shape
accum = np.empty_like(values)
accum.fill({{inf_val}})
if groupby_t is int64_t:
Copy link
Contributor

Choose a reason for hiding this comment

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

see some comments above

'mod': '__mod_{2}({0}, {1})',
'truediv': '__truediv_{2}({0}, {1})',
'floordiv': '__floordiv_{2}({0}, {1})',
'div': '__div({0}, {1})',
Copy link
Contributor

Choose a reason for hiding this comment

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

these names are odd

maybe just call them div and so on

@jbrockmendel
Copy link
Member Author

@datapythonista I don’t understand what is causing the travis failure. Do you recognize it?

@datapythonista
Copy link
Member

I'mc checking from my cell phone which makes it tricky to check, but if I see it correctly, this is the error: pandas/_libs/algos_rank_helper.pxi.in:177:80: E501 line too long (80 > 79 characters).

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.

small question, other lgtm.

@jreback jreback added this to the 0.24.0 milestone Oct 17, 2018
@jreback jreback merged commit e8d29e7 into pandas-dev:master Oct 17, 2018
@jreback
Copy link
Contributor

jreback commented Oct 17, 2018

thanks!

@jbrockmendel jbrockmendel deleted the temp5 branch October 17, 2018 16:00
tm9k1 pushed a commit to tm9k1/pandas that referenced this pull request Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internals Related to non-user accessible pandas implementation Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants