Skip to content

Instantly share code, notes, and snippets.

View mpolatcan's full-sized avatar
🙇‍♂️
Focusing...

Mutlu Polatcan mpolatcan

🙇‍♂️
Focusing...
  • Getir
  • Istanbul,Turkey
View GitHub Profile
@mpolatcan
mpolatcan / shell_oil_turkey_scraper.py
Last active July 11, 2020 19:37
Shell Oil Turkey oil prices data scraping
# Written by Mutlu Polatcan
# 09.07.2020
# =============================================
import requests
import re
from datetime import datetime, timedelta
class ShellOilTurkeyScraper:
URL = "https://www.turkiyeshell.com/pompatest/History.aspx"
@mpolatcan
mpolatcan / product_matching.py
Last active February 17, 2020 14:52
Match external market products with your product category, get n best match with your products using TF-IDF and Cosine similarity
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy.spatial.distance import cosine
def get_best_n_match(external_products_df, internal_products_dfs, count=3):
# Create vectorizer according to internal product space
vectorizer = TfidfVectorizer()
vectorizer.fit(internal_products_dfs.name)
@mpolatcan
mpolatcan / render_pandas_dataframe.py
Created February 13, 2020 07:21
Code snippet that renders DataFrame as image
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import six
import random
df = pd.DataFrame()
df['date'] = ['2016-04-{}'.format(day) for day in range(1, 51)]
df['calories'] = [random.randint(1500, 2000) for i in range(50)]
@mpolatcan
mpolatcan / gke_api_client.py
Created October 30, 2019 22:12
Google Kubernetes API Client to manage Google Kubernetes Engine Cluster written in Python
import base64
import json
from google.oauth2.service_account import Credentials
from google.cloud.container_v1 import ClusterManagerClient
from kubernetes.client import ApiClient, CoreV1Api
from kubernetes.client.configuration import Configuration as KubernetesClientConfiguration
from tempfile import NamedTemporaryFile
class KubernetesApiClient: