I am currently having a problem with a chain of methods when manipulating data frames in pandas, here is the structure of my data:
import pandas as pd
lst1 = range(100)
lst2 = range(100)
lst3 = range(100)
df = pd.DataFrame(
{'Frenquency': lst1,
'lst2Tite': lst2,
'lst3Tite': lst3
})
the question is getting records (rows) if the frequency is less than 6, but this needs to be done in the chain of methods.
I know that using the traditional method is easy, I could just do
df[df["Frenquency"]<6]
to get an answer.
However, the question is how to do this with a chain of methods, I tried something like
df.drop(lambda x:x.index if x["Frequency"] <6 else null)
but he raised a mistake "[<function <lambda> at 0x7faf529d3510>] not contained in axis"
Can anyone highlight this issue?
source
share