When we load a new DataFrame from a CSV, we want to know what it looks like.
If it is a small DataFrame, you can display by typing print(df).
If it's a larger DataFrame, it's helpful to be able to inspect a few items without having to look at the entire DataFrame.
The method .head() gives the first 5 rows of a DataFrame. If you want to see more rows, you can pass in the positional argument n. For example, df.head(10) would show the first ten rows.
The method df.info() gives some statistics for each column.
When we load a new DataFrame from a CSV, we want to know what it looks like.
If it is a small DataFrame, you can display by typing print(df).
If it's a larger DataFrame, it's helpful to be able to inspect a few items without having to look at the entire DataFrame.
The method .head() gives the first 5 rows of a DataFrame. If you want to see more rows, you can pass in the positional argument n. For example, df.head(10) would show the first ten rows.
The method df.info() gives some statistics for each column.