Streamlit - TypeError: sort_index() got an unexpected keyword argument 'ignore_index'

I’m trying to sort the index using the below line.

task_count_20.sort_index(ascending=False, ignore_index=True, inplace=True)

The above line of code is working in Google colab and in the local environment, but when I’m trying in building the app using streamlit, I’m getting the below traceback error.

TypeError: sort_index() got an unexpected keyword argument 'ignore_index'
File "", line 601, in <module>
    Lollipop_count_plot(df, col, count=20)
File "", line 209, in Lollipop_count_plot
    task_count_20.sort_index(ascending=False, ignore_index=True, inplace=True)#

In the official pandas documentation, sort_index() has the keyword ignore_index


DataFrame.sort_index(axis=0, level=None, ascending=True, inplace=False, kind=‘quicksort’, na_position=‘last’, sort_remaining=True, ignore_index=False, key=None)

Hi @krishna :wave:

This is not an issue with Streamlit, but is instead caused by an older version of pandas installed in the environment where you are building your app.

After searching through the pandas docs, it looks like the ignore_index keyword argument was added to DataFrame.sort_index() in version 1.0.0.

You can check the pandas version in your Streamlit app using:


If the version is < 1.0.0, you need to upgrade the pandas package in your environment.

Happy Streamlit’ing! :balloon: