October 2019
Beginner to intermediate
674 pages
16h 43m
English
squeeze helps to convert a 1D DataFrame to a series. Let's consider a 1D DataFrame:
dim1_df = sales_data[["Sales","OrderID"]].set_index("OrderID")dim1_df
The following will be the output:

The type of the preceding object has been deciphered here – it is a DataFrame:
type(dim1_df)
The following will be the output:
Now, let's apply the squeeze function and find the object type. The required snippet and the output looks as shown following:
type(dim1_df.squeeze())
Read now
Unlock full access