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 selenium import webdriver | |
| from selenium.webdriver.common.keys import Keys | |
| import pandas as pd | |
| driver = webdriver.Chrome('chromedriver.exe') | |
| driver.get('https://www.boxofficemojo.com/chart/top_lifetime_gross/?area=XWW') | |
| ## Scraping Movie Names | |
| movies_names = driver.find_elements_by_xpath('//td[@class="a-text-left mojo-field-type-title"]/a[@class="a-link-normal"]') ## targets all the elements on the web that has same Xpath | |
| movie_name_list = [] ## an empty list for storing movie names |
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 | |
| from ..items import BookscraperItem ## Importing The Class Inside Items.py for storing data | |
| class Bookscraper(scrapy.Spider): | |
| name='books' ## Name of Spider | |
| counter = 1 ## Counter Variable To Check The Status of Scraped Pages | |
| def start_requests(self): | |
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 | |
| from ..items import QuotescraperItem | |
| class Quotescraper(scrapy.Spider): | |
| name = 'quotes' | |
| counter = 1 ## Counter Variable To Check The Status of Scraped Pages | |
| start_urls = [ | |
| 'https://quotes.toscrape.com/page/1/' | |
| ] |
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 os import link | |
| from matplotlib.pyplot import title | |
| import scrapy | |
| from ..items import AmazonItem | |
| ## https://pypi.org/project/scrapy-user-agents/ | |
| class Amazonbookscraper(scrapy.Spider): | |
| name = "amazonbooks" |
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 streamlit as st | |
| import qrcode | |
| from PIL import Image, ImageOps | |
| st.write(''' # QR Code Generator ''') | |
| st.write(' A Web App That Generates QR Code') | |
| text = st.text_input("Enter Some Text...") | |
| if text!="": | |
| qr = qrcode.make(text) | |
| qr.save(f"{text}.png") | |
| st.image(f"{text}.png", use_column_width=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
| left = pd.DataFrame({'Courses': ["CSS","JS","JAVA"], | |
| 'Fee':[2499,4599,5799], | |
| 'Ratings':[3.5,4.2,3.9], | |
| 'ID':[1,2,3] | |
| }) | |
| right = pd.DataFrame({'Trn_ID':[1,1,1,2,2,3], | |
| 'Company':['Amazon','Dell','HP','Lenovo','Dell','HP']}) | |
| left.merge(right,left_on='ID',right_on='Trn_ID') |
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
| base_learners = [ | |
| ('l1', KNeighborsClassifier(n_neighbors=3)), | |
| ('l2', SVC(gamma=2, C=1)), | |
| ('l3',DecisionTreeClassifier()), | |
| ] | |
| model = StackingClassifier(estimators=base_learners, final_estimator=LogisticRegression()) |
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
| layer_1 = [ | |
| ('l1', KNeighborsClassifier(n_neighbors=3)), | |
| ('l2', SVC()), | |
| ('l3',DecisionTreeClassifier()) | |
| ] | |
| layer_2 = [ | |
| ('l4',RandomForestClassifier()), | |
| ('l5',DecisionTreeClassifier()) | |
| ] |
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 sklearn.datasets import load_iris | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.tree import DecisionTreeClassifier | |
| from sklearn.metrics import accuracy_score | |
| X, y = load_iris(return_X_y=True) | |
| X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, test_size=0.2,random_state=42) | |
| dt = DecisionTreeClassifier() | |
| dt.fit(X_train,y_train) |
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 sklearn.datasets import load_iris | |
| from sklearn.neighbors import KNeighborsClassifier | |
| from sklearn.tree import DecisionTreeClassifier | |
| from sklearn.svm import SVC | |
| from sklearn.ensemble import RandomForestClassifier | |
| from sklearn.linear_model import LogisticRegression | |
| from sklearn.ensemble import StackingClassifier | |
| from sklearn.model_selection import train_test_split | |
| X, y = load_iris(return_X_y=True) |