这就是我现在所拥有的,现在我被困住了。程序应该从一个csv文件中提取一个特定的列,然后它需要输入到上面的第一个浊度方程中,这个方程将给出浊度。从那里我需要把浊度和时间一起画在x轴上。我该怎么做呢?为了澄清csv文件的输入是伏特,需要将其转换为浊度,然后在y轴上绘制图形。你知道吗
以下是时代:6/27/2018 12:30, 6/27/2018 12:45, 6/27/2018 13:00
这些是伏特:1530102610, 1530103515,1530104412
Turbidity = (0.07642 * volts) + (-15.122))
这是方程式。你知道吗
Date/Time (UTC) Logger Time (unix timestamp) Raw Sensor (mV) LoggerID
6/27/2018 18:45 1530125111 4.61 Mill Creek B
7/3/2018 18:30 1530642609 92.14 Mill Creek B
7/3/2018 18:45 1530643509 92.03 Mill Creek B
7/3/2018 20:00 1530648013 91.24 Mill Creek B
。。。你知道吗
import pandas as pd
from datetime import datetime
import csv
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
headers = ['Raw Sensor','Date','Time']
df = pd.read_csv('turbiditydata.csv',names=headers)
print (df)
df['Date'] = df['Date'].map(lambda x: datetime.strptime(str(x), '%d/%m/%y %H:%M'))
x = df['Date']
y = df['Turbidity']
plt.plot(x,y)
plt.gcf().autofmt_xdate()
plt.title('Turbidity Over Time')
plt.show()
目前没有回答
相关问题 更多 >
编程相关推荐