I\'m a beginner in Python and the Pandas library, and I\'m rather confused by some basic functionality of DataFrame. I\'ve got a pandas DataFrame as below:
Try the below code segment:
from IPython.display import display
display(df.head())
DataFrame.head(n=5)
Return the first n rows.
This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it.
Parameters:
n : int, default 5
Number of rows to select.
Returns:
obj_head : type of caller
The first n rows of the caller object.
df.head(n)
returns a DataFrame
holding the first n rows of df.
Now to display a DataFrame
pandas checks by default the width of the terminal, if this is too small to display the DataFrame
a summary view will be shown. Which is what you get in the second case.
Could you increase the size of your terminal, or disable autodetect on the columns by pd.set_printoptions(max_columns=10)
?