We are trying to draw graphics in the laboratory.
We have data on the frequency of the motor. How to add to the table a new column filled with the calculated values from the freq2 column multiplied by 60 and bring it to the chart and call turns?
from pathlib import Path import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates plt.style.use('ggplot') p = Path(r'C:\NET\Log\Data') df = pd.concat([pd.read_csv(f, sep=';', header=None, usecols=[2,3,5], names=['date','time',f.stem], index_col=['date','time']) for f in p.glob('*.trd')], axis=1) df = df.set_index(pd.to_datetime(df.index.get_level_values(0) + ' ' + df.index.get_level_values(1))) fig, axes = plt.subplots(3, 1, figsize=(16, 8)); plt.legend(loc = 'upper left') df.filter(regex=r'^tmp').plot(ax=axes[0]) df.filter(regex=r'^press').plot(ax=axes[1], sharex=True) df.filter(regex=r'^tok').plot(ax=axes[2], sharex=True) ax_press = df.filter(regex=r'^freq2').plot(ax=axes[2], secondary_y=True) axes[-1].xaxis.set_major_formatter(mdates.DateFormatter('%H:%M\n%d.%m.%Y')) axes[0].set_ylabel('Температура') axes[1].set_ylabel('Давление') axes[2].set_ylabel('Ток мотора') ax_press.set_ylabel('Частота') axes[-1].set_xlabel('Время') Data here .