st.column_config.LinkColumn adding an extra string to my dataframe links

Continuing the discussion from How to display a clickable link pandas dataframe:

Summary

I am using st.column_config.LinkColumn(“Link column”) to make my links inside my dataframe clickable, streamlit is but doing the following and adding this bit to my links:

Normal Link:

www.xx-xxxxxx.de/xxxxxx.html

After applying st.column_config.LinkColumn(“Link column”) the label of the link remains the same, but the link itself changes to this an the page don’t open:

https://username-appname-appname-xxxxxx.streamlit.app/~/+/www.xx-xxxxxx.de/xxxxxx.html

Code snippet:

            st.dataframe(df,
                         column_config={
                            "Number": st.column_config.NumberColumn(format="%d"),
                             "Link": st.column_config.LinkColumn("Link")
                            }
                         )

I assume the issue here is that it’s interpreted as a relative URL since it does not start with http:// or https://. But I think we could also interpret www. prefix as a absolute URL as well, maybe something to suggest on our Github: Issues · streamlit/streamlit · GitHub

I have added to the links the following:

        df["Link"] = "https://"+df["Link"]

and it solve the problem. I will post it on the Github.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.