Dec-14-2017, 07:29 PM
(This post was last modified: Dec-14-2017, 08:03 PM by Afterdarkreader.)
So here's the full error information
Error:Traceback (most recent call last):
File "<ipython-input-41-862883395604>", line 1, in <module>
runfile('C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py', wdir='C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction')
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py", line 98, in <module>
ax.plot(x, yFunction(initialPop, popGrowth), 'p-', lw=1, alpha=0.6, label='Major Graph')
File "C:\Python27\lib\site-packages\matplotlib\axes\_axes.py", line 1377, in plot
self.autoscale_view(scalex=scalex, scaley=scaley)
File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 1984, in autoscale_view
y0, y1 = ylocator.view_limits(y0, y1)
File "C:\Python27\lib\site-packages\matplotlib\ticker.py", line 1375, in view_limits
return np.take(self.bin_boundaries(dmin, dmax), [0, -1])
File "C:\Python27\lib\site-packages\matplotlib\ticker.py", line 1347, in bin_boundaries
extra_bins = int(divmod((best_vmax - vmax), step)[0])
OverflowError: cannot convert float infinity to integerAnd here's the code:def yFunction(initialPop, popGrowth):
y=initialPop
yList = np.array([])
x=0
while x < 400:
yList = np.append(yList, y)
y = (y * np.exp(popGrowth * (x/4))) - (newsDiscussion(1, 20, x, 0.0015, 0.003, 0.55)*y)-(Tax2(156, 160, x, 0.05775, 0.1155, 0.55)*y)-(Tax1(80, 84, x, 0.77, 0.154, 0.55)*y)-(runVeganuaryMain(x)*y)
y = round(y, 5)
#y = newsDiscussion(1, 20, x, 0.0015, 0.003, 0.55)+(Tax2(156, 160, x, 0.05775, 0.1155, 0.55)*y)+(Tax1(80, 84, x, 0.77, 0.154, 0.55)*y)+(runVeganuaryMain(x)*y)
x = x + 0.1
return yList
yList = yFunction(initialPop, popGrowth)
print(yList)
x= np.linspace(0, 400, num=4000)
ax.set_title('Decrease in People Who Consume Animals ')
ax.set_xlabel('$Quarter$')
ax.set_ylabel('$Population$')
ax.plot(x, yFunction(initialPop, popGrowth), 'p-', lw=1, alpha=0.6, label='Major Graph')Can anyone tell me what's causing this error?So I figured out how to round the variables, but the function I used returns a string. Easy fix right? Just use Int()? Apparently not. My program is giving me a new error.
def yFunction(initialPop, popGrowth):
y=initialPop
yList = np.array([])
x=0
while x < 400:
yList = np.append(yList, y)
y = (y * np.exp(popGrowth * (x/4))) - (newsDiscussion(1, 20, x, 0.0015, 0.003, 0.55)*y)-(Tax2(156, 160, x, 0.05775, 0.1155, 0.55)*y)-(Tax1(80, 84, x, 0.77, 0.154, 0.55)*y)-(runVeganuaryMain(x)*y)
y = int(format(y, '.5f'))
x = x + 0.1
return yList
yList = yFunction(initialPop, popGrowth)
print(yList)
x= np.linspace(0, 400, num=4000)
ax.set_title('Decrease in People Who Consume Animals ')
ax.set_xlabel('$Quarter$')
ax.set_ylabel('$Population$')
ax.plot(x, yFunction(initialPop, popGrowth), 'p-', lw=1, alpha=0.6, label='Major Graph')Error:Traceback (most recent call last):
File "<ipython-input-52-862883395604>", line 1, in <module>
runfile('C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py', wdir='C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction')
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py", line 81, in <module>
yList = yFunction(initialPop, popGrowth)
File "C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py", line 78, in yFunction
y = int(format(y, '.5f'))
ValueError: invalid literal for int() with base 10: '326300000.00000'
