
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
BUG: rolling with axis=1, win_type=, and center=True raises ValueError Β· Issue #46135 Β· pandas-dev/pandas
Description:
Pandas version checks I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. I have confirmed this bug exists on the main branch of pandas. Reproducible Example imp...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Technology & Computing
- Video & Online Content
- Social Networks
Content Management System {π}
What CMS is github.com built with?
Github.com is built with WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 14,041,667 visitors per month in the current month.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 7,006,622 paying customers.
The estimated monthly recurring revenue (MRR) is $29,427,812.
The estimated annual recurring revenues (ARR) are $353,133,745.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
rolling, axis, bug, issue, pandas, added, sign, pandasdev, valueerror, projects, wintype, centertrue, raises, mvashishtha, fixed, mroeschke, jyuv, centeringtrue, doc, fix, centering, commit, references, navigation, pull, requests, actions, security, closed, description, version, confirmed, exists, printdfrollingwindow, wintypeboxcar, centertruesum, dataframe, triage, reviewed, team, member, mentioned, test, window, ewma, expanding, github, type, milestone, footer,
Topics {βοΈ}
0d7f375 mroeschke closed 2153f23 jyuv mentioned moved bug mention comment metadata assignees personal information bug raises valueerror issue description rolling doc section latest version pandas bug 46135 single-element dataframe center=true added test type projects projects milestone import pandas pandas-de⦠triage issue bug exists e64dee2 bug fixed bug centering=true fef5f93 doc main branch argument dimensions milestone relationships expect rolling test rolling fix rolling pandas pandas⦠valueerror window=1 github expanding type issue c3bdfb6 sign requested axis bug single rolling dataframe df fixed expanding centering sign axis=1 axis=0 axis 1
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:BUG: rolling with axis=1, win_type=, and center=True raises ValueError
articleBody:### Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
- [X] I have confirmed this bug exists on the main branch of pandas.
### Reproducible Example
```python
import pandas as pd
df = pd.DataFrame([[0]])
# this works:
print(df.rolling(window=1, axis=0, win_type="boxcar", center=True).sum())
# This raises ValueError:
print(df.rolling(window=1, axis=1, win_type="boxcar", center=True).sum())
```
### Issue Description
I start with a dataframe with a single value, 0. Rolling over columns with the above parameters gives:
```
0
0 3.0
```
Rolling over rows with `axis=1` instead gives `ValueError: Requested axis is larger then no. of argument dimensions`:
<details>
<summary>Show stack trace</summary>
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [48], in <module>
----> 1 df.rolling(window=1, axis=1, win_type="boxcar", center=True).sum()
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1216, in Window.sum(self, *args, **kwargs)
1212 window_func = window_aggregations.roll_weighted_sum
1213 # error: Argument 1 to "_apply" of "Window" has incompatible type
1214 # "Callable[[ndarray, ndarray, int], ndarray]"; expected
1215 # "Callable[[ndarray, int, int], ndarray]"
-> 1216 return self._apply(window_func, name="sum", **kwargs)
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1154, in Window._apply(self, func, name, numba_cache_key, numba_args, **kwargs)
1150 result = self._center_window(result, offset)
1152 return result
-> 1154 return self._apply_blockwise(homogeneous_func, name)
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:462, in BaseWindow._apply_blockwise(self, homogeneous_func, name)
459 for i, arr in enumerate(obj._iter_column_arrays()):
460 # GH#42736 operate column-wise instead of block-wise
461 try:
--> 462 res = hfunc(arr)
463 except (TypeError, NotImplementedError):
464 pass
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:452, in BaseWindow._apply_blockwise.<locals>.hfunc(values)
450 def hfunc(values: ArrayLike) -> ArrayLike:
451 values = self._prep_values(values)
--> 452 return homogeneous_func(values)
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1150, in Window._apply.<locals>.homogeneous_func(values)
1147 result = np.asarray(calc(values))
1149 if self.center:
-> 1150 result = self._center_window(result, offset)
1152 return result
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1092, in Window._center_window(self, result, offset)
1088 """
1089 Center the result in the window for weighted rolling aggregations.
1090 """
1091 if self.axis > result.ndim - 1:
-> 1092 raise ValueError("Requested axis is larger then no. of argument dimensions")
1094 if offset > 0:
1095 lead_indexer = [slice(None)] * result.ndim
ValueError: Requested axis is larger then no. of argument dimensions
```
</details>
### Expected Behavior
I expect rolling over axis 1 to give the same result as rolling over axis 0 for this single-element dataframe.
### Installed Versions
<details>
INSTALLED VERSIONS
------------------
commit : b4e578db857f0705144a56eac0ab65d6fb0a8760
python : 3.9.10.final.0
python-bits : 64
OS : Darwin
OS-release : 21.3.0
Version : Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.0.dev0+122.gb4e578db85
numpy : 1.22.1
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.3
setuptools : 60.8.2
Cython : 0.29.27
pytest : 7.0.0
hypothesis : None
sphinx : 4.4.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 8.0.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2022.01.0
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.9
pandas_gbq : 0.16.0
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : 2022.01.0
scipy : 1.7.3
sqlalchemy : 1.4.31
tables : 3.7.0
tabulate : None
xarray : 0.20.2
xlrd : 2.0.1
xlwt : None
zstandard : None
</details>
author:
url:https://github.com/mvashishtha
type:Person
name:mvashishtha
datePublished:2022-02-23T23:00:08.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:0
url:https://github.com/46135/pandas/issues/46135
context:https://schema.org
headline:BUG: rolling with axis=1, win_type=, and center=True raises ValueError
articleBody:### Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
- [X] I have confirmed this bug exists on the main branch of pandas.
### Reproducible Example
```python
import pandas as pd
df = pd.DataFrame([[0]])
# this works:
print(df.rolling(window=1, axis=0, win_type="boxcar", center=True).sum())
# This raises ValueError:
print(df.rolling(window=1, axis=1, win_type="boxcar", center=True).sum())
```
### Issue Description
I start with a dataframe with a single value, 0. Rolling over columns with the above parameters gives:
```
0
0 3.0
```
Rolling over rows with `axis=1` instead gives `ValueError: Requested axis is larger then no. of argument dimensions`:
<details>
<summary>Show stack trace</summary>
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [48], in <module>
----> 1 df.rolling(window=1, axis=1, win_type="boxcar", center=True).sum()
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1216, in Window.sum(self, *args, **kwargs)
1212 window_func = window_aggregations.roll_weighted_sum
1213 # error: Argument 1 to "_apply" of "Window" has incompatible type
1214 # "Callable[[ndarray, ndarray, int], ndarray]"; expected
1215 # "Callable[[ndarray, int, int], ndarray]"
-> 1216 return self._apply(window_func, name="sum", **kwargs)
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1154, in Window._apply(self, func, name, numba_cache_key, numba_args, **kwargs)
1150 result = self._center_window(result, offset)
1152 return result
-> 1154 return self._apply_blockwise(homogeneous_func, name)
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:462, in BaseWindow._apply_blockwise(self, homogeneous_func, name)
459 for i, arr in enumerate(obj._iter_column_arrays()):
460 # GH#42736 operate column-wise instead of block-wise
461 try:
--> 462 res = hfunc(arr)
463 except (TypeError, NotImplementedError):
464 pass
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:452, in BaseWindow._apply_blockwise.<locals>.hfunc(values)
450 def hfunc(values: ArrayLike) -> ArrayLike:
451 values = self._prep_values(values)
--> 452 return homogeneous_func(values)
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1150, in Window._apply.<locals>.homogeneous_func(values)
1147 result = np.asarray(calc(values))
1149 if self.center:
-> 1150 result = self._center_window(result, offset)
1152 return result
File /usr/local/lib/python3.9/site-packages/pandas/core/window/rolling.py:1092, in Window._center_window(self, result, offset)
1088 """
1089 Center the result in the window for weighted rolling aggregations.
1090 """
1091 if self.axis > result.ndim - 1:
-> 1092 raise ValueError("Requested axis is larger then no. of argument dimensions")
1094 if offset > 0:
1095 lead_indexer = [slice(None)] * result.ndim
ValueError: Requested axis is larger then no. of argument dimensions
```
</details>
### Expected Behavior
I expect rolling over axis 1 to give the same result as rolling over axis 0 for this single-element dataframe.
### Installed Versions
<details>
INSTALLED VERSIONS
------------------
commit : b4e578db857f0705144a56eac0ab65d6fb0a8760
python : 3.9.10.final.0
python-bits : 64
OS : Darwin
OS-release : 21.3.0
Version : Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.0.dev0+122.gb4e578db85
numpy : 1.22.1
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.3
setuptools : 60.8.2
Cython : 0.29.27
pytest : 7.0.0
hypothesis : None
sphinx : 4.4.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 8.0.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2022.01.0
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.9
pandas_gbq : 0.16.0
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : 2022.01.0
scipy : 1.7.3
sqlalchemy : 1.4.31
tables : 3.7.0
tabulate : None
xarray : 0.20.2
xlrd : 2.0.1
xlwt : None
zstandard : None
</details>
author:
url:https://github.com/mvashishtha
type:Person
name:mvashishtha
datePublished:2022-02-23T23:00:08.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:0
url:https://github.com/46135/pandas/issues/46135
Person:
url:https://github.com/mvashishtha
name:mvashishtha
url:https://github.com/mvashishtha
name:mvashishtha
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:0
interactionType:https://schema.org/CommentAction
userInteractionCount:0
External Links {π}(3)
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net