If by “outside of streamlit” you mean just a table rather than the scrollable tables then yes, you are right. Ideally I would like to use the scrollable table and HTML (all I really need is the link), but for now I’m happy to settle with having just a static table w/ the links.
As for the implementation, I used a combination of the suggestions here:
# pandas display options
pd.set_option('display.max_colwidth', -1)
def add_stream_url(track_ids):
return [f'https://open.spotify.com/track/{t}' for t in track_ids]
def make_clickable(url, text):
return f'<a target="_blank" href="{url}">{text}</a>'
# show data
if st.checkbox('Include Preview URLs'):
df['preview'] = add_stream_url(df.track_id)
df['preview'] = df['preview'].apply(make_clickable, args = ('Listen',))
st.write(df.to_html(escape = False), unsafe_allow_html = True)
else:
st.write(df)