Advertisement
santimirandarp

short python non working code with output error!

May 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3. import numpy as np
  4. data = pd.read_csv("test_peripheral_dat.csv",encoding = 'utf8')
  5. #import csv file
  6.  
  7. time=np.cumsum(data['Time step (secs)'])
  8. #this produces expected output (real time)
  9.  
  10. #now I need to plot time versus each column
  11. #and store in diff files
  12. counter=2
  13. for i in range(len(data.columns)-3):
  14.     #column=data.columns[counter]
  15.     #print(column)  
  16.     plotted_data=plt.scatter(x=time, y=data.columns[counter])
  17.     fig = plotted_data.get_figure()
  18.     fig.savefig('{}.png'.format(data.columns[counter]))
  19.     counter+=1
  20.  
  21. ValueError: x and y must be the same size
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement