Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Eror
#3
My first question is why you to add second dataframe unless it was just for exposition purposes.

My second question is why does the first python code in this form execute and the second one does not.

The code that does not work is in an earlier section of this post. I will now list the first code that does work.

q = df.loc[df2['machine_status']==0]['sensor_06']
p = df.loc[df2['machine_status']==1]['sensor_06'][:q.shape[0]]
Notice the similarity of the two code sets. One works with two dataframes and the other works with one dataframe.

They are almost the same, which is I why I applied the same python code (with minor modifications) in the second instance.

It just is a mystery to me why the first set works and the second set does not.

My book "Numerical Recipes in Statistics" gave me the code for the first instance so I thought I would apply it to the second. But that did not work!

There must have been a time when the second code set did work, and it is now out of date.

I am just interested in your opinion.

This one has really stumped me.

Help appreciated.

Respectfully,

LZ
Reply


Messages In This Thread
Coding Eror - by Led_Zeppelin - Sep-17-2022, 03:36 PM
RE: Coding Eror - by deanhystad - Sep-17-2022, 04:23 PM
RE: Coding Eror - by Led_Zeppelin - Sep-18-2022, 10:03 PM
RE: Coding Eror - by deanhystad - Sep-19-2022, 03:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  invalid syntax eror Larry 3 4,177 Feb-18-2018, 05:56 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020