import streamlit as st
import pandas as pd
df = pd.read.csv('path\to\a random.csv')
df_types = pd.DataFrame(df.dtypes, columns=['Data Type'])
where my csv file had 3 columns: Text (object), Date-Time (object), Number (float64).
However, I got this error message
StreamlitAPIException: Unable to convert numpy.dtype to pyarrow.DataType.
This is likely due to a bug in Arrow (see https://issues.apache.org/jira/browse/ARROW-14087).
As a temporary workaround, you can convert the DataFrame cells to strings with df.astype(str).
Could someone please explain why:
df_types is a dataframe but why it couldn’t be displayed?
what numpy.dtype did the error message refer to?
why was numpy.dtype needed to convert to pyarrow.DataType?
I also had the same issue on my function. I resolved it by converting my df_types Dataframe to df_types.astype(str) and Steamlit was able to render the Dataframe without issues
I haven’t really got the answer to that - but I presume so. Also what I noted is that from your code and my code is we are creating a dataframe comprising of dytpes - so st.dataframe(df_types) will cause that error yet if I load df using pd.read_csv then st.dataframe(df) you get no issues. I will be interest in finding out what is the real issue there as well.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.