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.