[program-l] Re: Scripting or ot: Consolidating a large number of CSV files and Excel sheets

  • From: ntsiklauri2@xxxxxxxxx
  • To: program-l@xxxxxxxxxxxxx
  • Date: Sat, 15 Jun 2019 12:52:06 +0400

yep! That’s good! By the way, to omit the step of installing python and all 
required modules on another PC, you could just bundle it to .exe file and 
distribut it that way. this is useful, when you know that the hosting PC does 
not have python installed, however is meeting all requirements to run it.
Best regards
Nick.

Sent from my iPhone

On Jun 15, 2019, at 12:05, Pranav Lal <pranav.lal@xxxxxxxxx> wrote:

Hi Nick and all,

Indeed, python seems to be the way to go. The pandas module has a lot of
what I need.

This is my script so far.
import os
import glob
import pandas as pd
import numpy as np

path = "my_dir_full_path"
allFiles = glob.glob(os.path.join(path,"*.csv"))


np_array_list = []
for file_ in allFiles:
   df = pd.read_csv(file_,index_col=None, header=0)
   np_array_list.append(df.as_matrix())

comb_np_array = np.vstack(np_array_list)
big_frame = pd.DataFrame(comb_np_array)
big_frame.drop_duplicates(subset='content', inplace=True)
big_frame.to_csv('out.csv', index=False)


Pranav

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: