I am getting the following error when I try to run this python file.
How can I fix this?
import matplotlib.pyplot as plt
fileobj = open('marchweatherfull.csv', 'r')
data = fileobj.readlines()
fileobj.close()
mins = [] # do the same for maxs, nines and threes
maxs = []
nines = []
threes = []
for line in data:
splitline = line.split(',')
mins.append(float(splitline[2]))
maxs.append(float(splitline[3]))
nines.append(float(splitline[10]))
threes.append(float(splitline[16]))
dates = [d for d in range(1,32)]
plt.plot(dates, mins, dates, maxs, dates, nines, dates, threes)
plt.show()
print(mins)
This is the error below:
[3, 6, 9, 12, 15] Traceback (most recent call last) : File "weather.py" line 5, in import matplotlib.pyplot as plt File "/usr/local/lib/python3.6/dist-packages/matplotlib/ init.py", line 139, in «modules from • import book, resetup File "/usr/local/lib/python3.6/dist-packages/matplotlib/cbook/init.py",line32,in<modules import numpy as np File "/usr/local/lib/python3.6/dist-packages/numpy/init.py",line142,in<modules from . import core File "/usr/local/lib/python3.6/dist-packages/numpy/core/_init.py",line 72, in «module> from . import numerictypes as nt File "/usr/local/lib/python3.6/dist-packages/numpy/core/numerictypes.py",line 599, in «module> register types() File "/us/local/lib/python3.6/dist-packages/numpy/core/numerictypes.py",line 594, in register _ty DeS numbers. Integral.register (integer) AttributeError: module "numbers" has no attribute 'Integral'
CodePudding user response:
In another stackoverflow similar Q says:
"Looking at the github link shared by Dušan Maďar, it is most likely that you have a file called 'numbers.py' which might be interfering with the python Lib.
Renaming that file should fix the issue."