Streamlit in Pandas Version 1.3+

Hi,

I have faced issues when I’m running some charts in Streamlit using Pandas 1.3 or greater, and to fix it I needed to downgraded the Pandas to any version below 1.3.

The most common error is: TypeError: _translate() missing 2 required positional arguments: ‘sparse_index’ and ‘sparse_cols’

Any update about whether it is planned to be fixed in the future?

Cheers,

Could you provide more info about your issue?

See also the posting guide.

Hi Ferdy,

Yes, we have an internal tool in Streamlit, that it does not work properly on Streamlit when the Pandas version is greater than 1.3. The charts don’t appear on the Streamlit interface, what happens instead is an error message - see below.

TypeError: _translate() missing 2 required positional arguments: 'sparse_index' and 'sparse_cols'
File "C:\Users\cvalenzuela\AppData\Roaming\Python\Python39\site-packages\streamlit\script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)File "C:\ProgramData\Anaconda3\Lib\site-packages\pyrpa\UI\capping_ui_v2.py", line 340, in <module>
    st.table(data=dec_df)File "C:\Users\cvalenzuela\AppData\Roaming\Python\Python39\site-packages\streamlit\elements\data_frame_proto.py", line 119, in table
    marshall_data_frame(data, table_proto)File "C:\Users\cvalenzuela\AppData\Roaming\Python\Python39\site-packages\streamlit\elements\data_frame_proto.py", line 149, in marshall_data_frame
    _marshall_styles(proto_df.style, df, styler)File "C:\Users\cvalenzuela\AppData\Roaming\Python\Python39\site-packages\streamlit\elements\data_frame_proto.py", line 168, in _marshall_styles
    translated_style = styler._translate()

You’d probably better upgrade streamlit instead of downgrading pandas.

Can you create a minimal sample code where we can reproduce the error?

What streamlit version did you use?

This was dealt with almost two years ago.

Yes, I tried it before downgrade Pandas.

I’ll try this one!

Here is the error. I should show a table with stats.

It is pretty much the same error as before. As I said, this was fixed almost two years ago. Your version of streamlit is too old.

1 Like

Yes, you’re right, in the most updated Streamlit version it’s running.

Thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.