Python Importing Data Cheat Sheet
Python Importing Data Cheat Sheet
Print first few Print the first few entries (default 5) of the df.head(n) #n=number of entries; default 5
entries pandas data frame
Print the last few entries (default 5) of the df.tail(n) #n=number of entries; default 5
Print last few entries
pandas data frame
Assign header Assign appropriate header names to the data df.columns = headers
names frame
Replace "?" with Replace the entries "?" with NaN entry from df = df.replace("?", np.nan)
NaN Numpy library
Retrieve data set Retrieve the summary of the data set being df.info()
summary used, from the data frame
Save data frame to Save the processed data frame to a CSV file df.to_csv(<output CSV path>)
CSV with a specified path
about:blank 1/1