lux-org / lux

Automatically visualize your pandas dataframe via a single print! 📊 💡
Apache License 2.0
5.15k stars 365 forks source link

[BUG] `lux.LuxDataFrame(df)` not working as intended #367

Closed westernguy2 closed 3 years ago

westernguy2 commented 3 years ago

Describe the bug Pandas DataFrame is able to make a copy of the DataFrame by calling pd.DataFrame(df). This is not the case for LuxDataFrame.

To Reproduce I encountered this error using the following code:

import pandas._testing as tm
df = tm.makeDataFrame()
lux.LuxDataFrame(df)

The output DataFrame is

Screen Shot 2021-04-21 at 3 40 00 PM

while it should be showing up as

Screen Shot 2021-04-21 at 3 39 40 PM

This bug doesn't happen in all cases, only some cases. For example

df = pd.read_csv('lux/data/car.csv')
lux.LuxDataFrame(df)

works as expected.

dorisjlee commented 3 years ago

Thanks for report this issue @westernguy2! Do you think this might be a result of the index column not being the typical ordered IntIndex, but something that looks like a result of set_index called on a column? It might be worth seeing if other such dataframes works or breaks.

westernguy2 commented 3 years ago

Yes, that is probably the reason this is happening, since that seems to be the main difference between the two examples. I will take a closer look at the index, thanks!