danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Feature request: New Query operator !=

Open manuelitox opened this issue 6 years ago • 3 comments

Hey folks!

Firstly, I want to say this project is awesome. I've been playing with him for two weeks and I've had a lot of fun

I have a little suggestion, when I'm trying to get a new data frame excluding a column value I'd like to use the query method by a new parameter (operator). Example:

const data = {
  'countries': ['Venezuela', 'Argentina', 'Colombia', 'Spain']
  'capital': ['Caracas', 'Buenos Aires', 'Bogota', 'Madrid']
}

let df = new dfd.DataFrame(data)
df = df.query({ "column": "countries", "is": "!=", "to": 'Spain' })

df.print()

// returns a countries table without the Spain row. 

It could be a powerful addition. I'd love to collab with a PR, please let me know your thoughts.

manuelitox avatar Oct 16 '20 12:10 manuelitox

@manuelitox Thanks for spotting that, you can go ahead and add it. I'll merge it

risenW avatar Oct 16 '20 20:10 risenW

Added! Thanks

risenW avatar Oct 19 '20 14:10 risenW

Awesome! I was going to work in that today haha.

Btw, could be useful to add the new operator in the DataFrame.query documentation.

manuelitox avatar Oct 20 '20 07:10 manuelitox