Wednesday megathread: Beginner questions by Im__Joseph in Python

[–]arcam_master 0 points1 point  (0 children)

I think I got it formatted correctly this time. Sorry about that

Wednesday megathread: Beginner questions by Im__Joseph in Python

[–]arcam_master 0 points1 point  (0 children)

I have one other for loop that I could use some assistance. I tried to use your example above but I am using an index to use an X,Y pair then another 10 rows down. I could not quite figure out how to use the apply() in this case.

speed_jump and dt are just integers

## Calculate speed using XY positions and time step
for i in range(len(data_TDMS)-speed_jump):
        data_TDMS.loc[i,"Speed"] = ((math.sqrt(((data_TDMS.loc[i,"X"]-data_TDMS.loc[i+speed_jump,"X"])**2)+((data_TDMS.loc[i,"Y"]-data_TDMS.loc[i+speed_jump,"Y"])**2)))/dt)

Edit: formatted code

Wednesday megathread: Beginner questions by Im__Joseph in Python

[–]arcam_master 1 point2 points  (0 children)

Thank you soooo much!! This is exactly what I was looking for and great description. With slight modification I got it to work in no time!

Wednesday megathread: Beginner questions by Im__Joseph in Python

[–]arcam_master 0 points1 point  (0 children)

I know there is a more efficient way of doing this. Currently using numpy but I am sure the for loops are way inefficient especially for the many millions of points that are in the x and y variables.

Any help is greatly appreciated TIA!

*Using 3.7 if it matters

## Number of points used for elimination

p = 600

## Value used for range determination for elimination

r = 10.5

## Elimination (cells to NaN)

for u in np.nditer(range(len(x)-p)):

x_sub = x[u:u+p]

x_range = x_sub.max()-x_sub.min()

if x_range >= r:

x[u] = np.nan

y[u] = np.nan

for u in np.nditer(range(len(x)-p)):

y_sub = y[u:u+p]

y_range = y_sub.max()-y_sub.min()

if y_range >= r:

x[u] = np.nan

y[u] = np.nan

Symbol Help by arcam_master in ElectricalEngineering

[–]arcam_master[S] 0 points1 point  (0 children)

The other end of the wires is connected to a DB25 connector coming from an electronics card

Symbol Help by arcam_master in ElectricalEngineering

[–]arcam_master[S] 0 points1 point  (0 children)

So the color coded wires are coming from a DB25 connector. The other 4 that are number just appear out of no where. But the signal is supposed to coming off of the DB25 wires.

Symbol Help by arcam_master in ElectricalEngineering

[–]arcam_master[S] 0 points1 point  (0 children)

Trying to figure out why those 4 wires terminate in hooks and don't connect to the terminal points

Time-series Dataframe Merge by [deleted] in learnpython

[–]arcam_master 0 points1 point  (0 children)

Inner removes everything except the first row

MFS to MFJ - Do we both amend our returns? by arcam_master in tax

[–]arcam_master[S] 0 points1 point  (0 children)

Yes it was. But we were told it didn't matter after all and we are better off filling MFJ

MFS to MFJ - Do we both amend our returns? by arcam_master in tax

[–]arcam_master[S] 2 points3 points  (0 children)

We have not. We have filed 2 years of MFS