Read CSV - PANDAS Read CSV Flashcards
Read CSV Files - A simple way to store big data sets is to use CSV files (comma separated files).
Read CSV Files
CSV files contains plain text and is a well know format that can be read by everyone including Pandas.
Read CSV Files
Use to_string() to print the entire DataFrame.
Read CSV Files
If you have a large DataFrame with many rows, Pandas will only return the first 5 rows, and the last 5 rows:
Read CSV Files
MAX_ROWS - The number of rows returned is defined in Pandas option settings.
Read CSV Files
You can check your system’s maximum rows with the pd.options.display.max_rows statement.
Read CSV Files
If DataFrame contains more than 60 rows, the print(df) statement will return only the headers and the first and last 5 rows.
Read CSV Files
You can change the maximum rows number with the same statement.
print(pd.options.display.max_rows)
Increase the maximum number of rows to display the entire DataFrame:
pd.options.display.max_rows = 9999
Exercise - CSV is short for:
Comma Separated Values
What is a correct syntax for loading a .csv file into a DataFrame?
df = pd.read_csv(‘data.csv’)
By default, if you print a large DataFrame with the print(df) function, Pandas will only return a selection of the data. How many rows will be returned?
10, the headers and the first and last 5 rows