Skip to content

Conversation

@jbrockmendel
Copy link
Member

Goal: simplify/perf for simple_new by requiring correct-type (no i8) values

Problem: a bunch of places pass i8 values

Solution: track then down and pass/return the right thing in the first place.


return values

def _datetimelike_compat(func):
Copy link
Member

Choose a reason for hiding this comment

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

I've just started (and I mean just) experimenting with having a numba version of the libs.

numpy datetime and timedeltas can be handled by numba. This means that _cast_values_for_fillna as removed here (but replaced with the decorator) and creating the view of the mask are unnecessary with numba. d449ca0

i suspect that many of the i8 conversions in the main codebase could become redundant (presumably numba deals with this)

with this in mind, would it be worth considering moving any i8 conversions into _libs? This may produce a cleaner _libs api and simplify the python code.

Copy link
Member

Choose a reason for hiding this comment

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

oh. and back to the PR. can you type the decorator to preserve the signature of the decorated function (ignoring that values to the decorator will be superset of values in the function, since we don't yet have type parameters for numpy arrays)

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've just started (and I mean just) experimenting with having a numba version of the libs.

neat!

with this in mind, would it be worth considering moving any i8 conversions into _libs? This may produce a cleaner _libs api and simplify the python code.

ill have to give that some thought. one wrinkle that comes to mind is that cdef functions dont tend to play nicely with decorators

Copy link
Member

Choose a reason for hiding this comment

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

may need a python interface layer in _libs, but early days yet since don't know how will handle pandas types that are defined as ctypes, without a performance hit.

# This needs to occur before datetime/timedeltas are cast to int64
mask = isna(values)
result = func(values.view("i8"), limit=limit, mask=mask)
return result.view(values.dtype)
Copy link
Member

Choose a reason for hiding this comment

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

since the cython funcs operate inplace, is it possible to just return values. or is a view of a view nbd.

Copy link
Member Author

Choose a reason for hiding this comment

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

yah lets save this for a future step

@jreback jreback added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Feb 27, 2021
@jreback jreback added this to the 1.3 milestone Feb 27, 2021
@jreback jreback added the Dtype Conversions Unexpected or buggy dtype conversions label Feb 27, 2021
@jreback jreback merged commit cff293b into pandas-dev:master Feb 27, 2021
@jbrockmendel jbrockmendel deleted the ref-missing-wrap branch February 27, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dtype Conversions Unexpected or buggy dtype conversions Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants