In Python you might come across IndexError: table of contents 2 is out of bounds for axis 0 with size 2 indigenous time to time.
The error relates to the usage of indexes and the no of columns you are referencing.
We discussed single positional indexer is out-of-bounds and also in the blog post, it was pertained to referencing indexes because that rows that carry out not exist.
In this blog post, the error relates come referencing the index because that columns that execute not exist.
Lets walk with the code below and also where the problem arises
So let us refresh ourselves through the data the is in the excel CSV document below:
Hi Sir,can friend please assist me v this?
_________________________________________import csvimport numpy as npfrom matplotlib income pyplot as plt
t0 = 0.0tf = 5000.0n = 5001dt = (tf-t0)/(n-1)t = np.linspace (t0,tf,n)g = 0.1Kp = -2.0Ti = 10Td = 0.0SP = 50.00h = np.zeros(
f = open(‘lfsretunepiddat.csv’)csv_f = csv.reader(f)nline = 0
for ar in csv_f: nline = nline + 1 fi
for i in range (1,n): h = h
for i in range (n): publish (t,h,fi,fo)
plt.plot(t,fi,’go–‘, linewidth=1, markersize=0.8 )plt.plot(t,fo,’ro–‘, linewidth=1, markersize=0.1 )plt.plot(t, h,’yo–‘, linewidth=1, markersize=0.1 )plt.xlabel(“Value of t”)plt.ylabel(“Value that fi,fo,h”)plt.title (“Level circulation Smoothing PID Simulation”)plt.show ()Reply
Leave a answer Cancel reply
Your email resolve will no be published. Required areas are marked *