fixed the join function OOPS
This commit is contained in:
@@ -4,19 +4,6 @@ import numpy as np
|
|||||||
|
|
||||||
global games_merged_dat
|
global games_merged_dat
|
||||||
|
|
||||||
# reading the data
|
|
||||||
# -> MAKE SURE OF THE DATA FRAMES NAMES PEFORE YOU RUN IT
|
|
||||||
|
|
||||||
games_dat = pd.read_csv("Games.xls")
|
|
||||||
games_sales_dat = pd.read_csv("vgsales-12-4-2019-short.csv")
|
|
||||||
|
|
||||||
games_merged_dat = games_dat.merge(
|
|
||||||
games_sales_dat, left_on="Name", right_on="Name", how="left"
|
|
||||||
)
|
|
||||||
print(games_merged_dat)
|
|
||||||
|
|
||||||
games_merged_dat.to_csv("output_final_df.csv")
|
|
||||||
|
|
||||||
|
|
||||||
# Defining useful Functions to be used later
|
# Defining useful Functions to be used later
|
||||||
def slice_column(input_df, column, expression=" "):
|
def slice_column(input_df, column, expression=" "):
|
||||||
@@ -32,5 +19,5 @@ def slice_column(input_df, column, expression=" "):
|
|||||||
|
|
||||||
|
|
||||||
def write_joined_df(left, right, lsuf="new_key"):
|
def write_joined_df(left, right, lsuf="new_key"):
|
||||||
merged = left.join(right, lsuffix=lsuf)
|
merged = pd.concat([left, right], sort=False, ignore_index=True) # Good
|
||||||
return merged
|
return merged
|
||||||
|
|||||||
Reference in New Issue
Block a user