You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When displaying a pandas dataframe with mo.ui.table or mo.ui.dataframe, the sort function sorts all data columns but not the index. The expected behavior is that sorting a column also changes the order of the index values to maintain the relation between index and the values for each row (or am I missing something here?).
Describe the bug
When displaying a pandas dataframe with mo.ui.table or mo.ui.dataframe, the sort function sorts all data columns but not the index. The expected behavior is that sorting a column also changes the order of the index values to maintain the relation between index and the values for each row (or am I missing something here?).
Sort 'col1':
![image](https://private-user-images.githubusercontent.com/32739313/344073325-f4c90ecf-1aa9-41aa-8f28-fc31da5c6699.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2ODY1MjIsIm5iZiI6MTcyNDY4NjIyMiwicGF0aCI6Ii8zMjczOTMxMy8zNDQwNzMzMjUtZjRjOTBlY2YtMWFhOS00MWFhLThmMjgtZmMzMWRhNWM2Njk5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI2VDE1MzAyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyMjBlNTUwZGZiMmM2Y2VjNzg5NDgyMWE5NDExNGQ3ZmNkNjBhM2VjNWE5MWI4NDdkOTE5ODkzMzI4MTMyOTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.j-wcSgzBcnJXEbouoFIGYKYZ_TAVKM9Se-bDfIkgnZQ)
Sort 'col2':
![image](https://private-user-images.githubusercontent.com/32739313/344073412-2877a1ad-a6cb-4a9d-92fa-828cb9e9eb80.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2ODY1MjIsIm5iZiI6MTcyNDY4NjIyMiwicGF0aCI6Ii8zMjczOTMxMy8zNDQwNzM0MTItMjg3N2ExYWQtYTZjYi00YTlkLTkyZmEtODI4Y2I5ZTllYjgwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI2VDE1MzAyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhN2MxZmQ3NjgwODJmMzRmNDQ3MTVlZDgzZDY1Njc0OTRkNjUwOTIyZTZmZGYxNDY5ZmEyNThlZTAyMTkxM2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uWPWWP6m5Q75PXhOP7CLJ43jscSwMc9NAyYx3lPAXlQ)
Environment
{
"marimo": "0.6.23",
"OS": "Linux",
"OS Version": "6.5.0-42-generic",
"Processor": "x86_64",
"Python Version": "3.11.6",
"Binaries": {
"Browser": "--",
"Node": "--"
},
"Requirements": {
"click": "8.1.7",
"importlib-resources": "missing",
"jedi": "0.19.1",
"markdown": "3.5.1",
"pymdown-extensions": "10.5",
"pygments": "2.17.2",
"tomlkit": "0.12.3",
"uvicorn": "0.25.0",
"starlette": "0.34.0",
"websockets": "12.0",
"typing-extensions": "4.9.0",
"black": "23.12.1"
}
}
Code to reproduce
import marimo as mo
import pandas as pd
d = {'col3': range(4), 'col1': [0, 1, 2, 3], 'col2': [6, 5, 4, 3]}
df = pd.DataFrame(data=d, index=[0, 1, 2, 3])
df.index.names = ["idx"]
mo.ui.dataframe(df)
mo.ui.table(df)
The text was updated successfully, but these errors were encountered: