1.1. Exercises
Delimiter
Coding questions
Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.
When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.
Reading in a URL
Let’s try reading in some data from a URL using pd.read_csv().
Tasks:
- Use
pd.read_csv()to read in the data from this url using the name column as the index. - Save the resulting dataframe as
pokemon_df. - Display the first 10 rows of the dataframe.
Reading in a Text File
Let’s try reading in a .txt file.
Tasks:
- Read in the data from a text file name
pokemon-text.txtlocated in thedatafolder. - Save the resulting dataframe as
pokemon_df. - It’s a good idea to see what the delimiter is.
- Display the first 10 rows of
pokemon_df.
Reading in an Excel File
Let’s try reading in an Excel file.
Tasks:
- Read in the data from the sheet named
pokemonfrom the Excel filepokemon.xlsxlocated in thedatafolder. - Save the resulting dataframe as
pokemon_df. - Display the first 10 rows of
pokemon_df.