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
  Does python guarantees that file.write() works without file.close() ? kryptomatrix 6 142 Oct-18-2019, 11:44 PM
Last Post: snippsat
  Writing list as a file, then reading that file as a list Zoastria_Balnala 3 98 Oct-17-2019, 07:54 PM
Last Post: Zoastria_Balnala
  Python Script for parsing dictionary values from yaml file pawan6782 3 199 Sep-04-2019, 07:21 PM
Last Post: pawan6782
  python file output to log file Rsh 4 300 Aug-13-2019, 09:00 PM
Last Post: DeaD_EyE
  How to fetch file from a list which match file extension suddhasilsarkar 1 148 Jul-30-2019, 11:54 AM
Last Post: Malt
  Trying to make column based file from text file scor1pion 7 278 Jul-16-2019, 02:43 PM
Last Post: scor1pion
  python script file not opening in IDLE editor srm 2 303 Jun-23-2019, 08:45 AM
Last Post: Larz60+
  Print a JSON file mrobie 5 412 May-31-2019, 09:38 PM
Last Post: Yoriz
  Redircet output of Python script to .txt file gurbhej_singh 7 724 May-20-2019, 01:11 AM
Last Post: woooee
  How to get the file path and full file name SriMekala 8 555 May-19-2019, 07:40 PM
Last Post: perfringo

Forum Jump:


Users browsing this thread: 1 Guest(s)