SHARE
TWEET

Untitled

a guest Sep 15th, 2016 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import csv
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. import pylab
  5. import pandas as pd
  6. from Tkinter import*
  7. import tkFileDialog as filedialog
  8. root=Tk()
  9. root.fileName=filedialog.askopenfilename(filetypes=(("csv files","*csv"),("All files","*.*" )))
  10. k=root.fileName
  11. print(k)
  12. root.destroy()
  13. pd.read_csv(k).mul(0.8).to_csv('minitest.csv', index=False)
  14.  
  15. with open('minitest.csv', 'rb') as input, open('temp.csv', 'w') as output:
  16.     reader = csv.reader(input, delimiter = ',')
  17.     writer = csv.writer(output, delimiter = ',')
  18.  
  19.     all = []
  20.     row = next(reader)
  21.     row.insert(0, '0')
  22.     all.append(row)
  23.     for k, row in enumerate(reader):
  24.         all.append([str(k+1)] + row)
  25.     writer.writerows(all)
  26.    
  27. with open('temp.csv','rb') as f:
  28.     r = csv.reader(f, delimiter='\t')
  29.     data = [line for line in r]
  30. with open('temp.csv','w') as f:
  31.     w = csv.writer(f, lineterminator='\n')
  32.     w.writerow(['Time','CH1','CH2','CH3','CH4','CH5','CH6','CH7','CH8'])
  33.     w.writerows(data)
  34.     print(data)
  35.  
  36. my_data = pd.read_csv('temp.csv',sep=u',', header=0, skip_footer=0)
  37. my_data.plot(x='Time',y=['CH1','CH2','CH3','CH4','CH5','CH6','CH7','CH8'],figsize=(14, 10))
  38. plt.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top