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
#!/usr/bin/env python | |
# coding: utf-8 | |
import numpy as np | |
from shapely.geometry import Polygon,Point | |
import matplotlib.pyplot as plt | |
import shapely | |
import cv2 as cv | |
import os |
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 selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
import pandas as pd | |
import numpy as np | |
import re | |
# Scrape one category # Travel |
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
for c in range(1,11): | |
print("http://books.toscrape.com/catalogue/category/books_1/page-{}.html".format(c)) |
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 selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
import pandas as pd | |
import numpy as np | |
import re | |
def StarConversion(value): |
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 selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
import pandas as pd | |
import numpy as np | |
import re | |
#Set up the path to the chrome driver | |
PATH = "/home/kiprono/chromedriver" |
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
multiple_elements = driver.find_elements_by_class_name("container1") | |
for element in multiple_elements: | |
print(element.text) |
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 selenium import webdriver | |
import time | |
PATH = "./chromedriver" | |
driver = webdriver.Chrome(PATH) | |
driver.get(url="file:///home/kiprono/Desktop/untitled.html") | |
print("Element identified by id:",driver.find_element_by_id("JDCf").text) | |
print("Element identified by class:",driver.find_element_by_class_name("container1").text) | |
print("Element identified by class:",driver.find_element_by_class_name("col4").text) | |
print("Element identified by tag name:",driver.find_element_by_tag_name("h1").text) |
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 selenium import webdriver | |
import time | |
PATH = "./chromedriver" | |
driver = webdriver.Chrome(PATH) | |
driver.get(url="file:///home/kiprono/Desktop/untitled.html") | |
time.sleep(5) | |
driver.close() |
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 pandas as pd | |
data = [] | |
with open("whatsapp.txt","r") as fp: | |
for index,line in enumerate(fp): | |
try: | |
send_time, message_section = line.strip().split("-") | |
sender, message = message_section.split(":",maxsplit=1) | |
date,time = send_time.split(",") | |
r = { | |
"Date": date, |
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
#most common words | |
print("Most Common emojis used (Me)") | |
common_emojis_me = Counter(myself_emojis).most_common() | |
common_emojis_her = Counter(mylove_emojis).most_common() | |
emojis_me = [] | |
count_me = [] | |
for index, item in enumerate(common_emojis_me): | |
if index == 5: | |
break | |
print(item) |
NewerOlder