soft-matter / trackpy

Python particle tracking toolkit
http://soft-matter.github.io/trackpy
Other
441 stars 131 forks source link

Remove a specific particle from my datas #704

Closed Alex-code-lab closed 2 years ago

Alex-code-lab commented 2 years ago

Hello everyone,

I'm trying to remove a particle from datas I found by tracking my particles.

df.particle == 0 # I can isolate where are found the particle 0 I want to remove from every frames
df[df.particle == 0] # I can isolate all the datas of the particle 0. Means that I have all the datas, frame by frame, for this particle. 

Then I tried : df.drop(df[df.particle == i].index)

but it remove all the data of the frame 0... I understood that "index" refers to the frame, but I don't know how to manage this.

Is anyone has a solution for me please?

Thank you all,

Alex

b-grimaud commented 2 years ago

If you simply want to remove a single particle, you could work the other way around by doing df = df[df.particle != i].

Alex-code-lab commented 2 years ago

Sorry, I didn't thank you for your help. It was what I was looking for. Thank. you