go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.98k stars 276 forks source link

How I can apply multiple values to a Dataframe Filter function. #85

Closed arshpreetsingh closed 4 years ago

arshpreetsingh commented 5 years ago

I have following: df = df.Rename("Account", "AccountID"). Filter(dataframe.F{"Event", "==", "bounced"}). Filter(dataframe.F{"Event", "==", "Sent"})

I want to do it like as:

df = df.Rename("Account", "AccountID"). Filter(dataframe.F{"Event", "==", ["bounced","Sent"]})

Is that possible?

danicat commented 5 years ago

Please have a look at the Filtering section in the README: https://github.com/go-gota/gota#filtering

arshpreetsingh commented 5 years ago

@danicat Looked into that already, not the one I am looking for,Please have a look a my code.

kniren commented 5 years ago

@arshpreetsingh I'm afraid you are not expressing yourself very clearly, but if what you want is an OR comparison (i.e. Event is equal to bounced or Event is equal to Sent), you can put two filters like such:

df = df.Rename(...).Filter(dataframe.F{"Event", "==", "bounced"}, dataframe.F{"Event", "==", "Sent"})

Please, next time make sure to read the documentation, as @danicat has pointed out.

arshpreetsingh commented 5 years ago

@kniren I had expressed My self, Already know what you and @danicat suggested. I was asking is it possible to pass multiple values in one Filter,

df = df.Rename(...).Filter(dataframe.F{"Event", "==", "bounced","Sent","Received"}

Huge thanks for reply.

danicat commented 5 years ago

Actually, having a second look at this you can use the "in" comparator which should have the effect you are looking for.

kniren commented 5 years ago

Does this answer your question @arshpreetsingh? If so, we should close the issue.

kniren commented 4 years ago

No answers from OP. Closing this issue.