>>> df = pd.DataFrame([1], columns=['A']) >>> df A 0 1 >>> df.squeeze() 1 >>> type(df.squeeze()) numpy.int64 >>> df.squeeze(axis=1) # Only want to squeeze a single dimension, i.e. into a series ... ValueError: the 'axis' parameter is not supported in the pandas implementation of squeeze()Problem description
np.squeeze
supports axis
parameter and this comment in the source implies it should eventually be implemented.
>>> df.squeeze(axis=1) # Squeeze a single dimension, i.e. into a series 0 1 Name: A, dtype: int64 >>> df.squeeze(axis=0) A 1 Name: 0, dtype: int64Output of
pd.show_versions()
pandas: 0.19.0+416.ge1390cd
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4