Black Lives Matter. Please consider donating to Black Girls Code today.

Make Datatable output in alphabetical order

Hi, I’m looking to create a small app to visualize distributions using the Upload data element and the editable datatable element. When users upload a .csv file I want them to be able to automatically choose some columns and distribute them with auto-generated histograms. Currently when I upload a csv the output I get is not alphabetically ordered and columns appear in a random order, but at the same time when I do any data manipulations in the background (like fetching the column name by it’s index or make a visualization) the dataframe is alphabetically ordered. How do I make the output of my dataframe appear in an alphabetical order?

hi @ivaylo, i think simply using pandas function sort_values would work here. Just sort the data frame you get before putting it out on table.