-
Notifications
You must be signed in to change notification settings - Fork 47
Add support for pandas eval #137
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
Comments
I think isnumeric will need to return true for pinttypes. Had a similar issue when plotting and pinttypes were filtered out by df.select_dytpes(is_numeric). pandas-dev/pandas#35340 You should open an issue in pandas for this. |
def isnumeric(dtype) -> bool:
return issubclass(np.dtype(dtype).type, np.number) At this stage
|
I faced a similar issue when getting plotting to work. A similar isnumeric command was returning false. The These are things that would need changing in pandas. you'll need to open an issue and pr there. |
Made a test to confirm that the issue is definitly on pandas side. I used IntegerArrays which are an other type of ExtensionArray and evals also fails at the df = pd.DataFrame({'a': pd.array([1, 2, 3]), 'b': pd.array([4, 5, 6])})
df.eval('a / b') leads to I'll open an issue there. |
This is more or less a note to myself but fell free to drop a comment if any of the above rings a bell. |
For the third item we can resolve the issue overloading the I think we can go as simple as the following example: class PintType(ExtensionDtype):
(...)
def _get_common_dtype(self, dtypes):
return self |
Two first point have been managed in pandas core. We can now concentrate on the third item. |
Hello, I'm running into an issue with using
pint_pandas
with pandas'eval
function:The problem arises when pandas tries to check if the columns are numeric by calling this function. This is in turn passed to
np.dtype(dtype)
, which results in the below type error.It's important for my application to use pandas eval, and the above is just a toy example.
Full stack trace:
The text was updated successfully, but these errors were encountered: