How can I assign a url to a button that redirect users to an external website when the data is split up into two data frames?

I have function in my view that fetches data from multiple spreadsheets and normalizes said data into one single data frame via Pandas. This df1 is eventually rendered and displayed in a webapp in the form of a bootstrap table using Django. For the sake of simplicity, let’s say this table has two columns: “Games” and “Link”. “Games" shows all the soccer matches for today and “link” simply has a button for each of the games. This button does nothing for now.

Now, I have another function that fetches data from a different source and again, normalizes the data using Pandas creating a df2 with three columns: “Games”: shows some soccer matches for today (this column has some but not all the games in df1 with exactly the same format). “Id”: a 4-digit identifier that is unique to each of the games above. “Url”: a url that contains the “id” and redirects the user to an external website that provides the user with extra information about that particular match.

I’m trying to figure out a way where the users can click on the buttons available in the webapp (which are linked to the games in df1) and get redirected to the external site using the urls listed in df2. I'm not looking for a breakdown of the code that would be needed to accomplish this but rather the general logic or approach that should be applied for my particular use case.

Appreciate your help in advance.

Data frames layout and expected result: (https://i.stack.imgur.com/wpnh8.png)

Back to Top