Question

In: Computer Science

Using HTML/Javascript (if needed) I want to create a table for a website that pulls data...

Using HTML/Javascript (if needed) I want to create a table for a website that pulls data from another website where the data is being updated on. Example: https://investors.coca-colacompany.com/stock-information/historical-data

I cannot just put in the numbers to a table as they will be getting updated daily. So it needs to link the the website elements.

DATE OPEN HIGH LOW CLOSE VWAP VOLUME % CHG CHANGE TRADE VAL TOTAL TRADES
2020-10-13 -- -- -- 51.09 -- -- 0.00% -- -- --
2020-10-12 50.84 51.525 50.83 51.09 51.155 11.39m 0.55% 0.28 582,437,982.00 70,341
2020-10-09 50.67 51.23 50.60 50.81 50.874 11.41m 0.69% 0.35 580,070,644.00 80,826

Table from:

https://investors.coca-colacompany.com/stock-information/historical-data

Solutions

Expert Solution

from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
def scrap():
        html = urlopen("https://investors.coca-colacompany.com/stock-information/historical-data").read()
        soup = BeautifulSoup(html, 'lxml')
        table = soup.find('table',{"class":"qmod-table qmod-table-hover qmod-pricehistory-table nowrap dataTable no-footer dtr-column collapsed"})
        price = []
        
        rows = table.find_all('tr')

        for row in range(len(rows)):
                price_row = []
                columns = rows[row].findAll('td')
                for column in columns: 
                        price_row.append(column.getText())
                price.append(team_row)
    
    return price
                                
                        
if __name__ == "__main__":
        price_matrix = scrap()
    ## Use the price matrix according to your suitability

Please find the above code for the approach, if found any issues please comment, it will be resolved as soon as possible.


Related Solutions

The code to create a Search/Filter Data with Javascript or html from html page.
The code to create a Search/Filter Data with Javascript or html from html page.
I want to create a d3 map visualization with timeseries data which pulls data from a...
I want to create a d3 map visualization with timeseries data which pulls data from a mysql table. The map will change data every second which would jump from data which contain x datetime to data which contain x+1 datetime (for example January 1 data to January 2). How can I do this? I already know how to set up a Flask API using Python which connects my visual to the database. I just need the SQL Query to change...
For this assignment you need to create a ToDo list using Javascript, along with HTML and...
For this assignment you need to create a ToDo list using Javascript, along with HTML and CSS. Begin by creating a HTML page called todo.html. Then create a Javascript file called todo.js and link it in to the HTML page using a script tag. All Javascript for the assignment must be in the separate file. (For CSS, feel free to include styles in a style block at the top of the HTML page, or to link in CSS from a...
For this assignment you need to create a ToDo list using Javascript, along with HTML and...
For this assignment you need to create a ToDo list using Javascript, along with HTML and CSS. Begin by creating a HTML page called todo.html. Then create a Javascript file called todo.js and link it in to the HTML page using a script tag. All Javascript for the assignment must be in the separate file. (For CSS, feel free to include styles in a style block at the top of the HTML page, or to link in CSS from a...
JS Bin / Tax Calculator / using HTML | CSS | JavaScript ------------------------------------------------------------------------------------------- How can I...
JS Bin / Tax Calculator / using HTML | CSS | JavaScript ------------------------------------------------------------------------------------------- How can I edit the JavaScript below so that when the calculate button is clicked the total price only shows two decimal places by using the toFixed() method? ----------------------------------------------------------------------------------------------------------- JavaScript: // Variables var tax = "tax"; // Tax percentage var taxRate = document.getElementById('tax'); // Selecting tax element // On the time of loading the DOM we are setting the tax rate window.addEventListener('DOMContentLoaded', (event) => { taxRate.value =...
Hi there, I have needed a big report about "Personal Portfolio Website" Which is included (HTML,...
Hi there, I have needed a big report about "Personal Portfolio Website" Which is included (HTML, CSS, JavaScript). You have to write briefly about HTML, CSS, JAVASCRIPT And Portfolio Website. Please try to write at least 5000 (Five Thousand) words. Thanks in Advanced.
Please Use JavaScript and HTML 5) Number guesser (easier) Create a number guessing name, using an...
Please Use JavaScript and HTML 5) Number guesser (easier) Create a number guessing name, using an input and a button to gather a number. The number to be guessed should be a hard-coded whole number between 1 and 20. Tell the user if the number is too high, equal to, or too low than a number you have hard-coded in your application. Remove the text in the input when the user clicks the button.
For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML...
For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML <canvas> tag. The game will be played "hot seat" where players take turns using the same device. Requirements: The canvas should be 600px tall and wide, with the gameplay area occupying most of the canvas. The X's and O's may be drawn using polygons or large-font text The grid should be drawn using polygons, specifically long, thin rectangles Before & between games, the canvas...
HTML I would like you to create a three paged website, where you can navigate to...
HTML I would like you to create a three paged website, where you can navigate to any page using a navigation bar. One page must include an ordered list, one page must include an unordered list. One page must include a picture. (please keep it appropriate.) Each page much include a header and a footer, please have your name on each footer with the copyright symbol next to it. Each page must be styled using CSS, and I would like...
I want to compare a string with the previous strings in a forEach loop using javascript....
I want to compare a string with the previous strings in a forEach loop using javascript. So im accessing data from an API. Im iterating through them using a forEach() loop. I want to compare the current 'title' string from the api with all previous title strings its pulled. The title is located under article.title fetch(req)             .then((response) => {                 return response.json();             })             .then((data) => {                 console.log(data);                 data.articles.forEach((article) => { } If the title matches any other title used already id...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT