-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Resampling and counting empty Series does not have a correct dtype #28427
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
Labels
Datetime
Datetime data dtype
Dtype Conversions
Unexpected or buggy dtype conversions
Resample
resample method
Milestone
Comments
Confirmed, thanks for the bug report. Not sure where this would be going wrong. |
This is coming from this: def _downsample(self, how, **kwargs):
"""
Downsample the cython defined function.
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function
"""
self._set_binner()
how = self._get_cython_func(how) or how
ax = self.ax
obj = self._selected_obj
if not len(ax): # <= This returns the wrong type in this case.
# reset to the new freq
obj = obj.copy()
obj.index.freq = self.freq
return obj
# do we have a regular frequency
if ax.freq is not None or ax.inferred_freq is not None:
if len(self.grouper.binlabels) > len(ax) and how is None:
# let's do an asfreq
return self.asfreq()
# we are downsampling
# we want to call the actual grouper method here
result = obj.groupby(self.grouper, axis=self.axis).aggregate(how, **kwargs)
result = self._apply_loffset(result)
return self._wrap_result(result) |
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 16, 2019
5 tasks
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 17, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 17, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 17, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Sep 19, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Oct 9, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Oct 9, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Oct 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Oct 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Oct 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Nov 16, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Nov 19, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Nov 19, 2019
randomstuff
pushed a commit
to randomstuff/pandas
that referenced
this issue
Nov 19, 2019
jreback
pushed a commit
that referenced
this issue
Nov 19, 2019
proost
pushed a commit
to proost/pandas
that referenced
this issue
Dec 19, 2019
proost
pushed a commit
to proost/pandas
that referenced
this issue
Dec 19, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Datetime
Datetime data dtype
Dtype Conversions
Unexpected or buggy dtype conversions
Resample
resample method
Code Sample, a copy-pastable example if possible
Short examples:
Longer example:
Problem description
When
.resample().size()
an empty dataframe, the resulting dtype is the dtype of the initial Series. It should be an integer.This means that this kind of things fail if the input
Series
happens to be empty:Expected Output
Output of
pd.show_versions()
pandas : 0.25.1
numpy : 1.17.2
pytz : 2019.2
dateutil : 2.8.0
pip : 18.1
setuptools : 40.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: