Skip to content

Instantly share code, notes, and snippets.

View mesutcanalkan's full-sized avatar

mesutcanalkan

  • QbizUK
  • London
View GitHub Profile
@mesutcanalkan
mesutcanalkan / BRING_SEASONAL_PLAYER_STATS.py
Last active November 9, 2021 22:41
Nba.com main function
def BRING_SEASONAL_PLAYER_STATS(URL_LINK):
driver = webdriver.Chrome(ChromeDriverManager().install())
# Open the URL on a google chrome window
driver.get(URL_LINK)
# As this is a dynamic html web-page, wait for 3 seconds for everything to be loaded
time.sleep(3)
@mesutcanalkan
mesutcanalkan / libraries_nba.py
Created November 9, 2021 22:31
libraries needed for nba web scraping
# !pip install webdriver-manager
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time
import pandas as pd
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
import re
@mesutcanalkan
mesutcanalkan / Read and Compare Ninja CSVs.py
Created March 7, 2021 01:06
Read and Compare Ninja CSVs
df_CSV_Files = pd.DataFrame([x.split('_') for x in
glob.glob('Data/'+ 'ninja_pv_coordinate_*.csv')],
columns=['NINJA', 'RENEWABLE', 'TYPE', 'YEAR', 'LATITUDE', 'LONGITUDE', 'SYSTEM_LOSS',
'TRACKING', 'TILT_DEGREE', 'AZIMUTH_DEGREE', 'EXTENSION']).astype(str)
df_CSV_Files['CF'] = pd.Series([pd.read_csv(x)['CF'].mean() for x in
glob.glob('Data/'+ 'ninja_pv_coordinate_*.csv')])
@mesutcanalkan
mesutcanalkan / Collect and Save Ninja PV Data CSVs.py
Created March 7, 2021 00:58
Collect and Save Ninja PV Data CSVs.py
TRACKING_OPTIONS_LIST = [0, 1, 2]
TILT_DEGREE_OPTIONS_LIST = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
AZIMUTH_DEGREE_OPTIONS_LIST = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180]
# Coordinates of the Chelsea and Westminster Hospital
LATITUDE = 51.48437
LONGITUDE = -0.18183
YEAR = 2017
@mesutcanalkan
mesutcanalkan / Ninja Function to load PV Data.py
Last active March 7, 2021 00:55
Ninja Function for API Call
def loading_generation_profile_data_from_ninja(PARAMS, WEATHER_YEAR, CAPACITY_CAL):
"""for a selected parameter dictionary, weather year, and capacity volume, an hourly capacity factor data frame is calculated.
in: parameters
out: dataframe
"""
TOKEN_ORDER = 0
TOKEN_LIST = LIST_OF_TOKENS