class AQGraph:
import pandas as pd
import numpy as np
import matplotlib as plt
PrimaryA = pd.read_csv('PrimaryA.csv') # Daily data from 12/1/19 to 4/16/20 from PrimaryA sensor
PrimaryB = pd.read_csv('PrimaryB.csv') # Daily data from 12/1/19 to 4/16/20 from PrimaryB sensor
AverageData = np.mean(PrimaryA[:][2], PrimaryB[:][2])
print(AverageData)
plt.plot(PrimaryA[:][0], AverageData)
plt.show()
Attached is my python code. I'm running it in Pycharm and for some reason the green arrow that pops up for Pycharm files isn't there. I've looked through my settings and I'm running Python 3.7. Any advice?
The code you provided, doesn't comply with python rules and standards. there is a class
in your code without any constructor or any method. Also, you didn't follow Python's indentation policy. Based on what you provided, as soon as you try to run it you should see an error.
import pandas as pd
import numpy as np
import matplotlib as plt
class AQGraph:
@staticmethod
def a_method():
PrimaryA = pd.read_csv('PrimaryA.csv') # Daily data from 12/1/19 to 4/16/20 from PrimaryA sensor
PrimaryB = pd.read_csv('PrimaryB.csv') # Daily data from 12/1/19 to 4/16/20 from PrimaryB sensor
AverageData = np.mean(PrimaryA[:][2], PrimaryB[:][2])
print(AverageData)
plt.plot(PrimaryA[:][0], AverageData)
plt.show()
if __name__ == "__main__":
AQGraph.a_method()
In the command line try:
> python python_file.py
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.