Sep-15-2022, 06:26 PM
(This post was last modified: Sep-15-2022, 06:32 PM by Led_Zeppelin.)
In the following code which as you can see there is one dataframe.
But when I use the following code which is very similar to the above code, I get an error.
The code is:
I need to know what to put in the fix this condition on the second function.
Respectfully,
LZ
q = df.loc[df2['machine_status']==0]['sensor_06'] p = df.loc[df2['machine_status']==1]['sensor_06'][:q.shape[0]] pp = sm.ProbPlot(p) pq = sm.ProbPlot(q) qqplot_2samples(pp,pq) plt.title("Q-Q plot of sensor_6 for machine_statuts") plt.show()I take the term to be a complete function when working on a dataframe. In this case data it is working on is df2. I know that they could use more meaningful names but bear with me. This works as shown in the attachment.
But when I use the following code which is very similar to the above code, I get an error.
The code is:
Output:NameError Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 q = df.loc[df2['machine_status']==0]['time_period']
2 p = df.loc[df2['machine_status']==1]['time_period'][:q.shape[0]]
4 pq = np.sum(p * np.log(p/q))
NameError: name 'df' is not defined
I am using the function in the same program in the same environment. It likes the first but does not like the second.I need to know what to put in the fix this condition on the second function.
Respectfully,
LZ