Oct-14-2019, 05:54 PM
Today I did this
import numpy as np import glob import pandas as pd import csv import os import matplotlib.pyplot as plt path = (r'C:\Users\Alphinity\Desktop\Data visualization\01-07-2019') all_files = glob.glob(os.path.join(path, 'test*.csv')) li = [] for filename in all_files: df = pd.read_csv(filename, index_col=None, header=0, sep = ';') li.append(df) df.dropna(inplace = True) frame = pd.concat(li, axis=0, ignore_index=True) cols = ['Time Peltier On:', 'T1', 'T2'] for i, row in df.iterrows(): plt.figure(figsize=(10,10)) plt.plot(row['Time Peltier On:'], df['T2'],label ='T2') plt.plot(df['Time Peltier On:'], df['T1'],label = 'T1') plt.ylim(-200,100) plt.grid(False) plt.xlabel('Time in Minutes',fontsize=14, fontweight='bold') plt.ylabel('Temperature in degree celcius',fontsize=14, fontweight='bold') plt.title('[Time Vs Temp]',fontsize=16, fontweight='bold') plt.legend() plt.show()But I'm getting always this problem, someone please could help me to find the solution ?
Error:Warning (from warnings module):
File "C:\Users\Alphinity\Desktop\Data visualization\01-07-2019\prova1.py", line 19
frame = pd.concat(li, axis=0, ignore_index=True)
FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.
To accept the future behavior, pass 'sort=False'.
To retain the current behavior and silence the warning, pass 'sort=True'.
Traceback (most recent call last):
File "C:\Users\Alphinity\Desktop\Data visualization\01-07-2019\prova1.py", line 27, in <module>
plt.plot(row['Time Peltier On:'], df['T2'],label ='T2')
File "C:\Program Files (x86)\Python37-32\lib\site-packages\matplotlib\pyplot.py", line 2795, in plot
is not None else {}), **kwargs)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\matplotlib\axes\_axes.py", line 1666, in plot
lines = [*self._get_lines(*args, data=data, **kwargs)]
File "C:\Program Files (x86)\Python37-32\lib\site-packages\matplotlib\axes\_base.py", line 225, in __call__
yield from self._plot_args(this, kwargs)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\matplotlib\axes\_base.py", line 391, in _plot_args
x, y = self._xy_from_xy(x, y)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\matplotlib\axes\_base.py", line 270, in _xy_from_xy
"have shapes {} and {}".format(x.shape, y.shape))
ValueError: x and y must have same first dimension, but have shapes (1,) and (891,)
Thank you so much