Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
DOC: Surprising behavior on DataFrame.squeeze() with 0 or 1 col/row #8999
Comments
TomAugspurger
added the
Docs
label
Dec 4, 2014
|
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? |
jreback
added this to the
0.16.0
milestone
Dec 4, 2014
jreback
added API Design Reshaping
labels
Dec 4, 2014
jreback
modified the milestone: 0.16.0, Next Major Release
Mar 6, 2015
|
@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 |
jreback
modified the milestone: 0.17.1, Next Major Release
Oct 3, 2015
jreback
added a commit
that referenced
this issue
Oct 9, 2015
|
|
MaximilianR + jreback |
aa94ae4
|
|
closed by #11230 |
jreback
closed this
Oct 9, 2015
yarikoptic
added a commit
to neurodebian/pandas
that referenced
this issue
Oct 11, 2015
|
|
yarikoptic |
cd7c38b
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TomAugspurger commentedDec 4, 2014
pd.DataFrame({"A": [1]}).squeeze() # -> 1 pd.DataFrame({"A": []}).squeeze() # NoopThe 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.