-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Surprising behavior on DataFrame.squeeze() with 0 or 1 col/row #8999
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
hmm, not sure if this is intuitve. I agree in that it should return an empty series. This is prob not tested at all. Maybe change and see if anything affected? |
@TomAugspurger just testing this issue with pandas version 0.16.2 and I get an empty DataFrame when I do df = pd.DataFrame({'A':[]})
print df.squeeze()
>>>
Empty DataFrame
Columns: [A]
Index: [] Is this what you meant by Noop? |
Sorry yeah, I should have been clearer. I meant the output was the same as the input (an Empty DataFrame). |
Ah ok, you meant Noop as in no-operation. |
Yep |
closed by #11230 |
* commit 'v0.17.0-8-gcac4ad2': (57 commits) BUG: to_excel duplicate columns BUG: HDFStore.append with encoded string itemsize, pandas-dev#11234 BUG: remove midrule in latex output with header=False BUG: squeeze works on 0 length arrays, pandas-dev#11299, pandas-dev#8999 DOC: add whatsnew 0.17.1 to index DOC: update resample docs timeseries: add tip about using groupby() rather than resample DOC: release_stats.sh script to report release stats DOC: edit release.rst CI: fix numpy to 1.9.3 in 2.7,3.5 builds for now, as packages for 1.10.0 not released ATM DOC: Included halflife as one 3 optional params that must be specified DOC: whatsnew 0.17.0 edits BUG/ERR: raise when trying to set a subset of values in a datetime64[ns, tz] column with another tz DOC: Add note about unicode layout DOC: hack to numpydoc to include attributes that are None (GH6100) DOC: add str accessor docstring pages to api.rst to avoid warning DOC: hack to numpydoc to avoid warnings for Categorical (not including members) skip some plotting tests if scipy is not installed add matplotlib to ci for 3.5 COMPAT/PERF: lib.ismember_int64 on older numpies/cython not comparing correctly PERF: use np.in1d on larger isin sizes ...
The second one is genuinely surprising; I would have expected it to return an empty Series with the name set to
A
. But it is consisent with numpy (np.array([[], []]).squeeze()
) so I've marked is as a doc issue.The text was updated successfully, but these errors were encountered: