Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clickable urls in dataframe views #76

Open
manycoding opened this issue Apr 30, 2019 · 2 comments
Open

Clickable urls in dataframe views #76

manycoding opened this issue Apr 30, 2019 · 2 comments
Assignees
Labels
Type: Feature New feature or request

Comments

@manycoding
Copy link
Contributor

manycoding commented Apr 30, 2019

It will be really convenient to have clickable urls, as opposing to manually copying them and opening a page each time. It will save time.
As far as I remember pandas has https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler, so maybe it can be used to achieve it.

@manycoding manycoding added the Type: Feature New feature or request label Apr 30, 2019
@manycoding
Copy link
Contributor Author

Workaround: classic notebook UI.

@tcurvelo
Copy link
Contributor

tcurvelo commented Jul 22, 2019

This snippet do the job, but it doesn't modify the df in-place, AFAIK (df.style returns a new Styler every time you call it).

def make_clickable(val):
    if isinstance(val, str) and re.search('^https?://', val):
        return f'<a target="_blank" href="{val}">{val}</a>'
    else:
        return val

df.style.format(make_clickable)

Maybe there is a way to create a default Styler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants