vaexio / vaex

Out-of-Core hybrid Apache Arrow/NumPy DataFrame for Python, ML, visualization and exploration of big tabular data at a billion rows per second 🚀
https://vaex.io
MIT License
8.28k stars 590 forks source link

[BUG-REPORT] empty filtered dataframe cannot be sliced #2123

Closed Ben-Epstein closed 2 years ago

Ben-Epstein commented 2 years ago

Thank you for reaching out and helping us improve Vaex!

Before you submit a new Issue, please read through the documentation. Also, make sure you search through the Open and Closed Issues - your problem may already be discussed or addressed.

Description Please provide a clear and concise description of the problem. This should contain all the steps needed to reproduce the problem. A minimal code example that exposes the problem is very appreciated.

Software information

Additional information

import vaex

df = vaex.example()
df_empty = df[df.x==4]
df_empty[:3]  # RuntimeError: end index should be larger or equal to start index
JovanVeljanoski commented 2 years ago

What would you expect to get? Since the dataframe you are slicing is empty..

Ben-Epstein commented 2 years ago

@JovanVeljanoski I'd expect an empty dataframe.

At least a helpful error if not, but I think it's reasonable to get an empty df

See below

x=[1,2,3]
y=x[:0]

z = y[:2]
print(x,y,z)
maartenbreddels commented 2 years ago

Yes, good point! Do you want to open a PR with a test in tests/slice_test.py? Then I'm happy to fix it! Do you agree @JovanVeljanoski ?

JovanVeljanoski commented 2 years ago

Agreed. Unit-test made