Wrong exception thrown for empty dataframe
See original GitHub issueUsing the get started query example https://danfo.jsdata.org/api-reference/dataframe/danfo.dataframe.query
let data = {"A": [30, 1, 2, 3],
"B": [34, 4, 5, 6],
"C": [20, 20, 30, 40]}
let cols = ["A", "B", "C"]
let df = new dfd.DataFrame(data, { columns: cols })
df.print() //before query
let query_df = df.query({ "column": "B", "is": ">", "to": 5 })
table(query_df)
I modified the condition to
let data = {"A": [30, 1, 2, 3],
"B": [34, 4, 5, 6],
"C": [20, 20, 30, 40]}
let cols = ["A", "B", "C"]
let df = new dfd.DataFrame(data, { columns: cols })
df.print() //before query
let query_df = df.query({ "column": "B", "is": ">", "to": 40 })
table(query_df)
Error message
File format not supported for now
Expected Output: Return empty result/array
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Wrong exception thrown for empty dataframe #37 - GitHub
When I am querying a DataFrame which would return an empty result, danfojs-node throws the following error (as it is implemented in core/frame.js)...
Read more >catch exception and return empty dataframe - Stack Overflow
This works fine when database query returns data but it throws an error when no data is returned(this is to be expected).
Read more >error handling; pandas and data analysis
pass is a special Python statement called a “null operation” or a “no-op”; it does nothing except keep going. try: x= math.sqrt(-1) except:...
Read more >Dealing with null in Spark - MungingData
All the blank values and empty strings are read into a DataFrame as null by ... Here's some code that would cause the...
Read more >Indexing and Selecting Data — pandas 0.15.0 documentation
In 0.15.0 Index has internally been refactored to no longer sub-class ... If a column is not contained in the DataFrame, an exception...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi everyone! When I am querying a DataFrame which would return an empty result, danfojs-node throws the following error (as it is implemented in core/frame.js)
Error: query returned empty databut shouldn’t it actually return an empty DataFrame like in Pandas? IMO, throwing an error breaks the chain of execution and it would make it difficult in cases where a decision is dependent on the query to return empty result or not.This has been fixed in the latest conversion to TS. See #235