Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Script to average 2 columns in .csv file, and print results to the file name.
#1
Hi everyone, I'm running a test which outputs numerous .csv files (around 12). I need to average out the data in column G (7) and H (8). I'd then like to have the averages and the title of column 'G (7) CMAA' and column 'H (8) TAA' printed to show up at the respective .csv file name.

ex

Original .csv file output from my benchmark:
TestResult-Run1
TestResult-Run2
TestResult-Run3
etc..

What I would like for my script to do:
TestResult-Run1_CMAA-3.46_TAA-4.67.csv
TestResult-Run2_CMAA-3.89_TAA-3.49.csv
TestResult-Run3_CMAA-3.45_TAA-4.21.csv
etc..

Is this possible with a .bat script?
Quote
#2
What's this got to do with python?
Quote
#3
Sorry, I'm using a .bat file to generate the .csv files. But I would like to have python do the averaging and renaming of the files if it's possible.
Quote
#4
You can do this with python quite easily actually.
Not sure of the best way to go about it, perhaps load into a list so you can add columns.
This will work if rows are symmetrical.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Rearrange Columns in a CSV File rjj920 1 121 May-09-2020, 03:26 PM
Last Post: DPaul
  Call a python file with anothr python file skaailet 3 173 Apr-30-2020, 03:41 PM
Last Post: deanhystad
  Building a script to check size of file upon creation mightyn00b 2 244 Apr-04-2020, 04:39 AM
Last Post: Larz60+
  Print/write to file function tpolim008 4 216 Apr-01-2020, 07:59 PM
Last Post: tpolim008
  Print date, Time and output to file tpolim008 3 185 Mar-26-2020, 06:49 PM
Last Post: ndc85430
  How to extract specific rows and columns from a text file with Python Farhan 0 224 Mar-25-2020, 09:18 PM
Last Post: Farhan
  Look for match in two files and print out in the first file Batistuta 0 172 Mar-03-2020, 02:27 PM
Last Post: Batistuta
  make a list of the file in the folder and change the name of file regarding to time go127a 5 359 Feb-21-2020, 10:36 AM
Last Post: go127a
  Python script merging some columns to one column with new name jbveenstra 6 328 Feb-13-2020, 02:01 PM
Last Post: jbveenstra
  Python: possibilty ro make a list of the file in the folder & change the name of file go127a 0 170 Feb-05-2020, 01:16 PM
Last Post: go127a

Forum Jump:


Users browsing this thread: 1 Guest(s)