I've been searching Stack for the answer to this question, and while the solutions presented here and here, for example, logically make sense I can't for the life of me implement them.
I am very new to Python, and while I know that I can do this in Excel super quick, I want to learn how to do it in Python so I'm not relying on Excel in the future.
Here's my current code (these are spread across different cells for my benefit when learning what I've written so I apologise if they're a little jarring to read):
## SECOND STEP: IMPORT CSVs INTO DATA FRAMES
# import module
import pandas as pd
# read datset
df1 = pd.read_csv("./csvs/Data1.csv")
df2 = pd.read_csv("./csvs/Data2.csv")
## FOURTH STEP - MERGE DATA FRAMES INTO 1 DATA SET
# Merging df1 and df2 with merge function with the common column as Name
# We use a Left join as DF2 contains the additional information we need in DF1
df3 = pd.merge(df1, df2, on='Title', how="left")
## FIFTH STEP - SPLIT COLUMN 'GENRE'
pd.concat([df3[[0]], df3['Genres'].str.split(',', expand=True)], axis=1)
The merged data from the 4th Step would look something like this (Basic Table Example with relative Column Headers):
I'm sure that what I'm doing wrong is fixable, but I would really appreciate the help to figure out why?