Skip to content

DOC: Can't figure out how to get exponential working #34593

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

Closed
2 of 3 tasks
tavurth opened this issue Jun 5, 2020 · 8 comments · Fixed by #34615
Closed
2 of 3 tasks

DOC: Can't figure out how to get exponential working #34593

tavurth opened this issue Jun 5, 2020 · 8 comments · Fixed by #34615

Comments

@tavurth
Copy link

tavurth commented Jun 5, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas as pd

to_test = pd.DataFrame({ "data": [1,2,3,4,5,6,7,8,9,10] })
exponent = to_test.rolling((3,4), win_type="exponential").mean()

print(exponent)
ValueError: exponential window requires tau
import pandas as pd

to_test = pd.DataFrame({ "data": [1,2,3,4,5,6,7,8,9,10] })
exponent = to_test.rolling(3, win_type="exponential", tau=4).mean()

print(exponent)
TypeError: rolling() got an unexpected keyword argument 'tau'

Problem description

I can't get exponential rolling working, and there's no documentation on this.

Expected Output

The exponential mean of the first 4 values

Output of pd.show_versions()

INSTALLED VERSIONS


commit : None
python : 3.7.7.final.0
python-bits : 64
OS : Darwin
OS-release : 19.3.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 1.0.4
numpy : 1.18.5
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 46.0.0
Cython : 0.29.17
pytest : 5.4.2
hypothesis : None
sphinx : None
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.14.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.2.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.17.0
pytables : None
pytest : 5.4.2
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : 0.8.7
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None

@tavurth tavurth added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 5, 2020
@tavurth
Copy link
Author

tavurth commented Jun 5, 2020

I finally fixed this by changing the code as follows:

import pandas as pd

to_test = pd.DataFrame({ "data": [1,2,3,4,5,6,7,8,9,10] })

exponent = to_test.rolling(3, win_type="exponential").mean(tau=5)

print(exponent)
   data
0   NaN
1   NaN
2   2.0
3   3.0
4   4.0
5   5.0
6   6.0
7   7.0
8   8.0
9   9.0

Sorry I marked this as a bug, I just figured it out.

Perhaps this could be documented somewhere? I can't find any other reference online about this.

@tavurth tavurth changed the title BUG: HELP: Can't figure out how to get exponential working Jun 5, 2020
@tavurth tavurth changed the title HELP: Can't figure out how to get exponential working DOC: Can't figure out how to get exponential working Jun 5, 2020
@MarcoGorelli
Copy link
Member

Thanks @tavurth for the report

there's no documentation on this.

Here it is https://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.Series.rolling.html

Though to be fair, perhaps exponential (needs tau) doesn't make it too clear where the tau needs to go, so if you have an idea on how to clarify this, I think a PR would be welcome

@simonjayhawkins simonjayhawkins added Docs good first issue and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 5, 2020
@linnndachen
Copy link
Contributor

How about exponential (needs tau in operation argument)?

@MarcoGorelli
Copy link
Member

Yes, I think that would be clearer - would you like to submit a pull request, @wchen928 ? If so, perhaps reword the others where this happens too (e.g. gaussian (needs std))

@linnndachen
Copy link
Contributor

Yes, I think that would be clearer - would you like to submit a pull request, @wchen928 ? If so, perhaps reword the others where this happens too (e.g. gaussian (needs std))

Sounds good. I will do that.

linnndachen added a commit to linnndachen/pandas that referenced this issue Jun 6, 2020
DOC: Clarify where to the additional arguments for some win_types
For example, std needs to specify when win_types is gaussian. However, std should be specified in the operation argument, not as one of the rolling arguments. This change is to clarify this point. 

Closes: pandas-dev#34593
linnndachen added a commit to linnndachen/pandas that referenced this issue Jun 6, 2020
DOC: Clarify where to the additional arguments for some win_types
For example, std needs to specify when win_types is gaussian. However, std should be specified in the operation argument, not as one of the rolling arguments. This change is to clarify this point. 

Closes: pandas-dev#34593
@linnndachen
Copy link
Contributor

I hope I did it right. I am not sure what the 5 tasks are. Do I need to check them off? or the reviewer will check them off? Sorry about the entry-level question... this is my first commit.

@dsaxton
Copy link
Member

dsaxton commented Jun 6, 2020

I hope I did it right. I am not sure what the 5 tasks are. Do I need to check them off? or the reviewer will check them off? Sorry about the entry-level question... this is my first commit.

You did, for documentation fixes like this most of those boxes don't really apply (and actually checking them off isn't a big deal, more important is the content of the changes)

@linnndachen
Copy link
Contributor

You did, for documentation fixes like this most of those boxes don't really apply (and actually checking them off isn't a big deal, more important is the content of the changes)

Thank you so much for the explanation!

mroeschke pushed a commit that referenced this issue Jun 18, 2020
…4615)

* DOC: Clarify some syntax when using win_types

DOC: Clarify where to the additional arguments for some win_types
For example, std needs to specify when win_types is gaussian. However, std should be specified in the operation argument, not as one of the rolling arguments. This change is to clarify this point. 

Closes: #34593

* DOC: Clarify where to the additional arguments for some win_types

Edit: 711add5 First Commit
Original issue: #34615

* DOC: Clarify where to the additional arguments for some win_types

Edit: a3e38ac Second Commit 

What's new: I shortened line 935 so that each line is less than 88 characters. 

Original Issue: #34615

* Revert "DOC: Clarify where to the additional arguments for some win_types"

This reverts commit 45be538.

* Revert "Revert "DOC: Clarify where to the additional arguments for some win_types""

This reverts commit 05ed0eb.

* DOC: Remove whitespace in docstring

* DOC: Remove indent of line934

* Update pandas/core/window/rolling.py

Co-authored-by: Tom Augspurger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants