This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set new-column-uca5 in StudentsPerformance_csv to =(math score+reading score+writing score)/3 | |
| StudentsPerformance_csv['average'] = (StudentsPerformance_csv['math score']+StudentsPerformance_csv['reading score']+StudentsPerformance_csv['writing score'])/3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Added column new-column-uca5 to StudentsPerformance_csv | |
| StudentsPerformance_csv.insert(8, 'new-column-uca5', 0) | |
| # Renamed new-column-uca5 to average in StudentsPerformance_csv | |
| StudentsPerformance_csv.rename(columns={'new-column-uca5': 'average'}, inplace=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| class WorldometersSpider(scrapy.Spider): | |
| name = 'worldometers' | |
| allowed_domains = ['www.worldometers.info'] | |
| start_urls = ['https://www.worldometers.info/world-population/population-by-country/'] | |
| def parse(self, response): | |
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| class WorldometersSpider(scrapy.Spider): | |
| name = 'worldometers' | |
| allowed_domains = ['www.worldometers.info'] | |
| start_urls = ['https://www.worldometers.info/world-population/population-by-country/'] | |
| def parse(self, response): | |
| # Getting all the rows of the table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| class WorldometersSpider(scrapy.Spider): | |
| name = 'worldometers' | |
| allowed_domains = ['www.worldometers.info'] | |
| start_urls = ['https://www.worldometers.info/world-population/population-by-country/'] | |
| def parse(self, response): | |
| # Getting all the rows of the table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get the transcript | |
| element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPath, '//div[@class="full-script"]'))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bs4 import BeautifulSoup | |
| import requests | |
| root = 'https://subslikescript.com' | |
| website = f'{root}/movies' | |
| result = requests.get(website) | |
| content = result.text | |
| soup = BeautifulSoup(content, 'lxml') | |
| box = soup.find('article', class_='main-article') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import openpyxl | |
| from openpyxl import load_workbook | |
| from openpyxl.styles import Font | |
| from openpyxl.chart import BarChart, Reference | |
| import string | |
| def automate_excel(file_name): | |
| """The file name should have the following structure: sales_month.xlsx""" | |
| # read excel file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #select only upcoming matches box | |
| box = driver.find_element_by_xpath('//div[contains(@testid, "Program_SELECTION")]') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #scroll down to the bottom to load upcoming matches | |
| driver.execute_script("window.scrollTo(0, document.body.scrollHeight)") | |
| time.sleep(3) #add implicit if necessary |