Introduction to Importing Data in Python
👋 Welcome to your new workspace! Here, you can experiment with the data you used in Introduction to Importing Data in Python and practice your newly learned skills with some challenges. You can find out more about DataCamp Workspace here.
Below is a code cell that imports the course packages.
🏃To execute the code, click inside the cell to select it and click "Run" or the ► icon. You can also use Shift-Enter to run a selected cell and automatically switch to the next cell.
# Import the course packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
import h5py
from sas7bdat import SAS7BDAT
from sqlalchemy import create_engine
import pickle
Challenge Yourself
Don't know where to start? Add code to the code cells below to try one (or more) of the following challenges.
Reminder: To execute the code you add to a cell, click inside the cell to select it and click "Run" or the ► icon. You can also use Shift-Enter to run a selected cell and automatically switch to the next cell.
1. Import the first 100 rows of data in datasets/titanic_sub.csv
as a pandas DataFrame.
# 1. Import the first 100 rows of datasets/titanic_sub.csv
2. Import the data in the sheet labeled "2002" in the file datasets/battledeath.xlsx
as a pandas DataFrame.
# 2. Import the '2002' sheet of datasets/battledeath.xlsx
3. Using the database in datasets/Chinook.sqlite
, query the entire Artist
table and store the results as a pandas DataFrame.
# 3. Import the Artist table from datasets/Chinook.sqlite
4. Import the data in datasets/seaslug.txt
as a NumPy array, skipping the first row.
# 4. Import the data contained in seaslug.txt
Continue to Explore
Feeling confident about your skills? Continue to Intermediate Importing Data in Python! This course will help you continue to develop essential importing skills, including how to import data from the web and interact with APIs.
If you would like to continue to practice your importing skills with flat files, you can try importing the remaining datasets:
datasets/disarea.dta
datasets/ja_data2.mat
datasets/L-L1_LOSC_4_V1-1126259446-32.hdf5
datasets/mnist_kaggle_some_rows.csv
datasets/sales.sas7bdat