-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
rolling.apply or rolling.agg doesn't work on string columns #20773
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
Apply
Apply, Aggregate, Transform, Map
Dtype Conversions
Unexpected or buggy dtype conversions
Enhancement
Window
rolling, ewma, expanding
Comments
14 tasks
added it to the master tracker, but this would require some work. you are welcome to submit a PR. |
you can do this (the
|
@jreback Thanks. Think another solution is get a hash on the string column and then counting unique hashing values. |
This looks like a duplicate of #23002 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Apply
Apply, Aggregate, Transform, Map
Dtype Conversions
Unexpected or buggy dtype conversions
Enhancement
Window
rolling, ewma, expanding
Code Sample, a copy-pastable example if possible
Problem description
What I am trying to do is counting how many unique values in a rolling window. This works well for the numeric column dat.number but the string column dat.string simply only returns what it was.
In the above example, I expect to see the two columns in the output are the same as the number of unique values are 1, 1, 2 starting from the first row. However the string column returns a, a, b.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-38-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_AU.UTF-8
LOCALE: en_AU.UTF-8
pandas: 0.22.0
pytest: None
pip: 9.0.3
setuptools: 39.0.1
Cython: None
numpy: 1.14.2
scipy: 1.0.1
pyarrow: None
xarray: None
IPython: 6.3.0
sphinx: 1.7.2
patsy: 0.5.0
dateutil: 2.7.2
pytz: 2018.3
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: