Skip to content

Instantly share code, notes, and snippets.

View kipronokoech's full-sized avatar
🎯
Focusing

Kiprono Elijah Koech kipronokoech

🎯
Focusing
View GitHub Profile
#!/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
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
for c in range(1,11):
print("http://books.toscrape.com/catalogue/category/books_1/page-{}.html".format(c))
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):
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"
multiple_elements = driver.find_elements_by_class_name("container1")
for element in multiple_elements:
print(element.text)
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)
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()
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,
#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)