Error: Unrecognized type: "Duration" (18)

print(df)
st.code(df)
works fine
but for the below code v get this error:
Code snippet:

st.dataframe(df)

Error: Unrecognized type: “Duration” (18)

45429/Or.decode@http://localhost:8501/static/js/main.ef6eee61.js:2:1279841
Ui@http://localhost:8501/static/js/main.ef6eee61.js:2:1277207
45429/Mr.decode@http://localhost:8501/static/js/main.ef6eee61.js:2:1280985
45429/value/a._createHeader@http://localhost:8501/static/js/main.ef6eee61.js:2:1274812
value@http://localhost:8501/static/js/main.ef6eee61.js:2:1273978
value@http://localhost:8501/static/js/main.ef6eee61.js:2:1298560
r@http://localhost:8501/static/js/main.ef6eee61.js:2:3558089
a@http://localhost:8501/static/js/main.ef6eee61.js:2:3567834
value@http://localhost:8501/static/js/main.ef6eee61.js:2:1294514
Ea@http://localhost:8501/static/js/main.ef6eee61.js:2:1310499
e@http://localhost:8501/static/js/main.ef6eee61.js:2:1311161
get@http://localhost:8501/static/js/main.ef6eee61.js:2:4459684
ua@http://localhost:8501/static/js/main.ef6eee61.js:2:4560433
ua@http://localhost:8501/static/js/main.ef6eee61.js:2:2418064
Gu@http://localhost:8501/static/js/main.ef6eee61.js:2:2470364
ks@http://localhost:8501/static/js/main.ef6eee61.js:2:2457607
qs@http://localhost:8501/static/js/main.ef6eee61.js:2:2457535
_s@http://localhost:8501/static/js/main.ef6eee61.js:2:2457396
gs@http://localhost:8501/static/js/main.ef6eee61.js:2:2454362
30534/Ko/<@http://localhost:8501/static/js/main.ef6eee61.js:2:2403856
13095/t.unstable_runWithPriority@http://localhost:8501/static/js/main.ef6eee61.js:2:3355037
Zo@http://localhost:8501/static/js/main.ef6eee61.js:2:2403633
Ko@http://localhost:8501/static/js/main.ef6eee61.js:2:2403803
$o@http://localhost:8501/static/js/main.ef6eee61.js:2:2403736
fs@http://localhost:8501/static/js/main.ef6eee61.js:2:2451739
enqueueSetState@http://localhost:8501/static/js/main.ef6eee61.js:2:2407754
80306/m.prototype.setState@http://localhost:8501/static/js/main.ef6eee61.js:2:2733858
value@http://localhost:8501/static/js/main.ef6eee61.js:2:4701204
scriptFinished@http://localhost:8501/static/js/main.ef6eee61.js:2:4686682
n/o.handleMessage/<@http://localhost:8501/static/js/main.ef6eee61.js:2:4686019
n/o.handleMessage@http://localhost:8501/static/js/main.ef6eee61.js:2:4686090
e/<@http://localhost:8501/static/js/main.ef6eee61.js:2:4657884
d@http://localhost:8501/static/js/main.ef6eee61.js:2:3560563
74165/o/v/<@http://localhost:8501/static/js/main.ef6eee61.js:2:3561907
74165/o/y/</<@http://localhost:8501/static/js/main.ef6eee61.js:2:3560926
r@http://localhost:8501/static/js/main.ef6eee61.js:2:3553763
u@http://localhost:8501/static/js/main.ef6eee61.js:2:3553967

Any suggestions please.

2 Likes

Hi @Sai_SaiGraph! :wave:

Did you encounter a similar error when using st.table()?

If so, have you tried converting the ‘Duration’ column to a string format before displaying it? You can achieve this by using the .astype(str) method from Pandas.

df['your_duration_column'] = df['your_duration_column'].astype(str)
st.dataframe(df)

If neither of these solutions is working for you or suitable for your needs, then I’ll investigate the matter further.

Let me know! :slight_smile:
Charly

Hi @Sai_SaiGraph , this is a known issue right now :frowning: Error: Unrecognized type: "Duration" (18) · Issue #4489 · streamlit/streamlit · GitHub

1 Like

Below are the columns i have and Days_Hold is the only column which seems to be date related so i converted using Wills suggestion like this:

df_results[‘Days_Hold’] = df_results[‘Days_Hold’].astype(str)
st.table(df_results[cols])

but still get the same error.

Below are the columns orignal:

Hi Charly
Just windering if there is any update on this.
thanks
Sai

Your code works for me with my own data (same columns, shape and dtypes) and making cols = ["Days_Hold"]