-
-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
BUG: downsampling with last doesn't accept "min_count" keyword #37768
Comments
Actually it looks like the docstrings are wrong here. The underlyin implementation does not support a min_count keyword for the functions GroupBy docs are more or less erroneous too. You can pass
|
It might be a copy paste error in the documentation. If so I still would like to see this as an enhancement. Let me know which way you and team decide to go, to fix the documentation or enhance the code. Happy to raise an enhancement request in the prior case. There is a case to have "min_count" option , especially when downsampling with .last(). The reason is that .last() takes the last non-nan value of the bin/segment, without actually ensuring it is the last value in the time series. "min_count" can prevent undesired values from being chosen. |
Looking at the implementation of the functions @phofl identified, it appears straightforward to add |
I verified this on v 1.1.3. I am on miniconda, 1.1.4 is not available yet. There are ways to install probably but if I read documentation right, this feature should be around since 0.22
Problem description
According to the documentation, .last() does accept the keyword "min_count", just like for example .sum()
where it works fine, see above
So I should not see the error above. The "min_count" is useful also for .last() if you have nans in your data and want to avoid the record that is not truly the last record in the segment.
Doc:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.resample.Resampler.last.html#pandas.core.resample.Resampler.last)
Expected Output
Output of
pd.show_versions()
See above - verified with pd 1.1.3. I started the issue on my laptop with older pandas but finished with 1.1.3. Error message and pd.show_versions() is up to date
INSTALLED VERSIONS
commit : db08276
python : 3.7.6.final.0
python-bits : 64
OS : Windows
OS-release : 8.1
Version : 6.3.9600
machine : AMD64
processor : Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.1.3
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.4
setuptools : 50.3.1.post20201107
Cython : None
pytest : None
hypothesis : None
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.1.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : 0.49.1
The text was updated successfully, but these errors were encountered: