How to fix StreamlitAPIException: (“Expected bytes, got a ‘int’ object”, ‘Conversion failed for column FG% with type object’)

We Are Going To Discuss About How to fix StreamlitAPIException: (“Expected bytes, got a ‘int’ object”, ‘Conversion failed for column FG% with type object’). So lets Start this Python Article.

How to fix StreamlitAPIException: (“Expected bytes, got a ‘int’ object”, ‘Conversion failed for column FG% with type object’)

  1. How to solve How to fix StreamlitAPIException: (“Expected bytes, got a 'int' object”, 'Conversion failed for column FG% with type object')

    It’s a bug that came with streamlit 0.85.0. pyarrow has an issue with numpy.dtype values (which df.dtypes returns).
    The issue has been filed and hopefully will be taken care of soon.
    A possible workaround is to convert DataFrame cells to strings with df.astype(str)
    In your case
    test = df_selected_team.astype(str) st.dataframe(test)
    or
    downgrade your streamlit version to 0.84
    or
    A preferable solution for this is to use the old dataframe serializer by setting this in your .streamlit/config.toml file:
    [global] dataFrameSerialization = "legacy"
    This allows you to continue upgrading to the latest version of Streamlit.
    Follow this thread for more updates

  2. How to fix StreamlitAPIException: (“Expected bytes, got a 'int' object”, 'Conversion failed for column FG% with type object')

    It’s a bug that came with streamlit 0.85.0. pyarrow has an issue with numpy.dtype values (which df.dtypes returns).
    The issue has been filed and hopefully will be taken care of soon.
    A possible workaround is to convert DataFrame cells to strings with df.astype(str)
    In your case
    test = df_selected_team.astype(str) st.dataframe(test)
    or
    downgrade your streamlit version to 0.84
    or
    A preferable solution for this is to use the old dataframe serializer by setting this in your .streamlit/config.toml file:
    [global] dataFrameSerialization = "legacy"
    This allows you to continue upgrading to the latest version of Streamlit.
    Follow this thread for more updates

Solution 1

It’s a bug that came with streamlit 0.85.0. pyarrow has an issue with numpy.dtype values (which df.dtypes returns).

The issue has been filed and hopefully will be taken care of soon.

A possible workaround is to convert DataFrame cells to strings with df.astype(str)

In your case

test = df_selected_team.astype(str)
st.dataframe(test)

or

downgrade your streamlit version to 0.84

or

A preferable solution for this is to use the old dataframe serializer by setting this in your .streamlit/config.toml file:

[global]
dataFrameSerialization = "legacy"

This allows you to continue upgrading to the latest version of Streamlit.

Follow this thread for more updates

Original Author Pluviophile Of This Content

Solution 2

I had the same problem. Then I downgraded my streamlit version to make it work, currently, I’m running streamlit 0.75.

Original Author ahmedshahriar Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment