Skip to content

Joining Data with pandas

Run the hidden code cell below to import a few of the datasets used in this course.

Note: There are a large number of datasets in the datasets/ folder. Many of these are Pickle files, which you can read using pd.read_pickle(path_to_file). An example is included in the cell below.

# Import pandas
import pandas as pd

# Import some of the course datasets 
actors_movies = pd.read_csv("datasets/actors_movies.csv")
business_owners = pd.read_pickle("datasets/business_owners.p")
casts = pd.read_pickle("datasets/casts.p")

# Preview one of the DataFrames
casts

Reshaping Data with .melt()

To change a table from long form to wide form social_fin_long = social_fin.melt(id_vars = ["Facebook","Twitter"]), var_name = "year", value_name = "annual") print (social_fin_tall.head(10))

Add your notes here

# Add your code snippets here