Merge two identical CSV from the same directory - Python -


i have 2 data frames same structure in csv. want read both csv , merge them create 1 bigger data frame. in directory there 2 data frames.

the first csv called "first":

ad   7   8   5   8 ty   9   y 

the second csv called "second":

ewtw   5   2     1   2 ty     4   9 

my code is:

  import os   import pandas pd    targetdir = "c:/documents , settings/user01/mis documentos/experpy"      filelist = os.listdir(targetdir)     file in filelist :       df_csv=pd.read_csv(file)        big_df = pd.concat(df_csv) 

unfortunately, didn’t work. how can fix that?

if going have 2 csvs may want use pd.merge

first = pd.read_csv( 'first.csv' ) # insert file path second = pd.read_csv( 'second.csv' )  big_df = (first, second, how='outer') # union of first , second 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -