Good! Now that we've briefly introduced Series, it's time for the real fun: DataFrames.
A DataFrames resemble a table or Excel sheet: it contains columns and rows. Working with DataFrames is very intuitive. One of the easiest ways to create a DataFrame is by reading a CSV file:
hospital_data = pd.read_csv('hospitals.csv')
The code above will read the
hospitals.csv file into a new variable named
In real life, CSV files often use separators other than commas. Luckily, you can specify the separator to meet your needs. For example, we can specify that the separator used in the file is the semicolon (
hospital_data = pd.read_csv('hospitals.csv', sep=';')