-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DataFrame.apply adds a frequency to a freq=None DatetimeIndex as a side-effect #22150
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
Comments
Can you provide a more minimal example to reproduce the issue? |
Yes. I have reduced the conditions to the following:
One example is
|
Thanks @dycw. I can reproduce with a similar example:
#14927 may be playing a role here somewhere. Investigation and PR' are always welcome! |
I would like to look into this, however, am quite new to open source - can I ask questions here if I get stuck or rather in another place, e.g. Gitter? |
@HannahFerch high level can ask questions here or on Gitter. For detailed code review it is easiest if you just push a PR and get feedback directly on that |
@WillAyd Makes sense. Thanks! |
I have been looking at the example of @mroeschke. The setting of the frequency takes place in pandas.core.apply.FrameRowApply when wrapping the results with wrap_results_for_axis(). This calls self.obj._constructor, which returns a results object with freq='WOM-4FRI' instead of the original freq='None' that went inside. |
It would be more ideal to prevent |
# Conflicts: # doc/source/whatsnew/v0.24.0.txt
…andas-dev#22150 # Conflicts: # doc/source/whatsnew/v0.24.0.txt
Code Sample, a copy-pastable example if possible
Output:
Problem description
This particular index (found by hypothesis) suddenly gains a frequency it is used in a DataFrame, with >= 2 columns, which goes on to call ".apply".
Expected Output
for all n.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-514.16.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C
LOCALE: None.None
pandas: 0.23.3
pytest: 3.6.4
pip: 18.0
setuptools: 39.2.0
Cython: None
numpy: 1.15.0
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.5.0
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.2.10
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: