Comments (2)
Thanks for the report. But this is an upstream issue as pandas would need an arrow compute kernel to call on mod apache/arrow#28497
Going to close as an upstream issue
from pandas.
Thanks. Seems the upstream issue has been there for a few years now.
Here I provide a workaround that might be helpful to anyone who needs the mod
function.
def pa_mod(val, divisor):
if divisor <= 0:
raise ValueError('Divisor must be a positive integer')
if divisor & (divisor - 1) == 0:
remainder = val & (divisor - 1)
else:
quotient = val // divisor
remainder = val - (quotient * divisor)
return remainder
Test code:
d = pd.DataFrame({'x': np.arange(-10, 10)}, dtype='int64[pyarrow]')
d = d.assign(y=pa_mod(d['x'], 3))
print(d)
d = pd.DataFrame({'x': np.arange(-10, 10)-0.5}, dtype='float64[pyarrow]')
d = d.assign(y=pa_mod(d['x'], 3))
print(d)
from pandas.
Related Issues (20)
- BUILD: pandas on conda main repo installs `numexpr`, while on `conda-forge` it does not HOT 7
- BUG/inconsistency: pd.Series(dtype=object).sum(skipna=True) does not respect skipna=True HOT 2
- API: handling of missing values in Index.__contains__ HOT 2
- BUG: to_datetime raises "AttributeError: 'NoneType' object has no attribute 'total_seconds'" even with errors='coerce' HOT 3
- BUG: replace with 3 or more `None` values fails when copy_on_write is enabled HOT 2
- ENH: ArrowTemporalProperties' object has no attribute 'to_period'
- BUG: tz-aware series with NaT raises exception on .to_numpy("datetime64") HOT 1
- BUG: pd.concat() cannot concatenate more than 3 mixed-frequency dataframes with multi-index series HOT 1
- BUG: assert_frame_equal triggers DeprecationWarning with column with empty lists/arrays
- ENH: Add a clear option to interpret strings as Pandas dtypes specifically. HOT 1
- BUG: Ambigious behaviour of multiplication assignment operator for series of type integer HOT 1
- Consider moving pyarrow's pandas compatibility and conversion code to the pandas project? HOT 1
- ENH: Allow custom aggregation functions with multiple return values. HOT 2
- DOC: Questions on Usage of *args, **kwargs, and inplace parameters in pandas.Series.cat methods HOT 1
- DOC: Series.update throws a `FutureWarning` about `def[col] = df[col].method` but `.update` returns `None` and works `inplace` HOT 3
- DOC: Intro to data structures HOT 3
- ENH: to_excel: warning/conversion of text values starting with '=' HOT 6
- DOC: Separate Examples for String Methods (str.isalnum(), str.isalpha(), etc.) in docs HOT 2
- ENH: Add kwargs to `Series.map` HOT 3
- No Python 3.13 wheels available in scientific-python-nightly-wheels HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandas.