This file contains 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 Fask class from flask library | |
from flask import Flask, render_template | |
#Associating that class to a object. __name__ special variable that will get the value of the name of the python script | |
app=Flask(__name__) | |
#Python script Python assign the name manin this string to the file | |
#Case 1: Script executed __name__ = "__main__" | |
@app.route('/') |
This file contains 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 flask import Flask, render_template, request | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from send_email import send_email | |
from sqlalchemy.sql import func | |
app = Flask(__name__) | |
db = SQLAlchemy(app) | |
app.config['SQLALCHEMY_DATABASE_URI']='postgresql://postgres:skateboard@localhost/salary_collector' | |
class Data(db.Model): |
This file contains 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
# Regression template | |
# Importing the Libraries | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
# Importing the dataset | |
dataset = pd.read_csv('Data.csv') | |
X = dataset.iloc[:, 1:2].values |
This file contains 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
# Importing the dataset | |
dataset = read.csv('data.csv') | |
# Splitting the datase into the Training set and Test set | |
#install.packages('caTools') | |
library(caTools) | |
set.seed(123) | |
split = sample.split(dataset$DependentVariable, SplitRatio = 0.8) | |
training_set = subset(dataset, split == TRUE) | |
test_se = subset(dataset, split == FALSE) |
This file contains 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
# Regression Template | |
# Importing the dataset | |
dataset = read.csv('Position_Salaries.csv') | |
dataset = dataset[2:3] # Take into consideration onle 2 and 3 columns | |
# Splitting the datase into the Training set and Test set | |
#install.packages('caTools') | |
#library(caTools) | |
#set.seed(123) |
This file contains 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 cv2, time | |
#1. Create an object. Zero for external camera | |
video=cv2.VideoCapture(0) | |
#7. Play the video (Indenting) | |
#8. a variable | |
a=0 |
This file contains 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
"""This app. will collect the data about Mowbray Court Hotel from Booking.com | |
Prepared by Vytautas Bielinskas at Ekistics Property Advisors LLP""" | |
from selenium import webdriver | |
options = webdriver.chrome.options.Options() | |
options.add_argument("--disable-extensions") | |
chrome_path = r"C:\Users\user\Desktop\Python\JSscrapping\chromedriver.exe" | |
driver = webdriver.Chrome(chrome_path) |
This file contains 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 requests, re | |
from bs4 import BeautifulSoup | |
l = [] | |
base_url = 'https://www.booking.com/searchresults.en-gb.html?label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaIgBiAEBmAEZwgEKd2luZG93cyAxMMgBDNgBAegBAfgBC5ICAXmoAgM;sid=20c42c0b783aafadf5e96bb173c1c595;class_interval=1;dest_id=-2601889;dest_type=city;group_adults=2;group_children=0;label_click=undef;no_rooms=1;raw_dest_type=city;room1=A%2CA;sb_price_type=total;src=index;src_elem=sb;ss=London;ssb=empty;rows=15;offset=' | |
def count_objects(base_url): | |
r = requests.get(base_url + "00") | |
c = r.content |
This file contains 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 statsmodels.formula.api as sm | |
def backwardElimination(x, sl): | |
numVars = len(x[0]) | |
for i in range(0, numVars): | |
regressor_OLS = sm.OLS(y, x).fit() | |
maxVar = max(regressor_OLS.pvalues).astype(float) | |
if maxVar > sl: | |
for j in range(0, numVars - i): | |
if (regressor_OLS.pvalues[j].astype(float) == maxVar): | |
x = np.delete(x, j, 1) |
This file contains 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 statsmodels.formula.api as sm | |
def backwardElimination(x, SL): | |
numVars = len(x[0]) | |
temp = np.zeros((50,6)).astype(int) | |
for i in range(0, numVars): | |
regressor_OLS = sm.OLS(y, x).fit() | |
maxVar = max(regressor_OLS.pvalues).astype(float) | |
adjR_before = regressor_OLS.rsquared_adj.astype(float) | |
if maxVar > SL: | |
for j in range(0, numVars - i): |