Skip to content

Instantly share code, notes, and snippets.

View shandytp's full-sized avatar

shandytp shandytp

View GitHub Profile
@shandytp
shandytp / user.py
Created February 19, 2024 13:51
method untuk upgrade plan PacFlix
# create upgrade_plan method based on username
def upgrade_plan(self, username, upgrade_plan):
DISCOUNT = 0.05
# iterate keys and values based on data
for key, value in data.items():
if key == self.username:
get_current_plan = value[0]
def data_validation(data: pd.DataFrame):
# check data shape
n_rows = data.shape[0]
n_cols = data.shape[1]
print("========== Start Data Validation Pipeline ==========")
print(f"Number of rows: {n_rows}")
print(f"Number of cols: {n_cols}")
@shandytp
shandytp / example.py
Created December 12, 2023 13:07
python docstring example
def menghitung_volume_kubus(rusuk):
"""
function ini untuk menghitung volume kubus
Parameter
---------
rusuk = input rusuk dari kubus
Returns
-------
@shandytp
shandytp / check_plan.py
Created November 22, 2022 13:50
method untuk check plan
def check_plan(self, username):
for key, value in data.items():
if key == self.username:
print(f"Nama Plan: {value[0]}")
print(f"Sudah Berlangganan: {value[1]} Bulan")
print("")
try:
if value[0] == "Basic Plan":
table = [[True, "Bisa Stream"],
@shandytp
shandytp / preprocess_data.py
Created August 11, 2021 05:51
track count function
def track_count(df_name):
return df_name.groupby(['artist', 'album']).count()
@shandytp
shandytp / preprocess_data.py
Created August 11, 2021 05:50
function for filter by artist name
def filterByArtist(df_name, artist_name):
return df_name[df_name['artist'] == artist_name]
@shandytp
shandytp / preprocess_data.py
Created August 11, 2021 05:48
create decode JSON function
def decode_JSON(data_path, encode='utf-8'):
return json.load(open(data_path, encoding=encode))
@shandytp
shandytp / library.py
Created August 11, 2021 05:45
import some library
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings as wrn
import json
from utils.preprocess_data import decode_JSON, filterByArtist, track_count
wrn.filterwarnings('ignore', category = DeprecationWarning)
wrn.filterwarnings('ignore', category = FutureWarning)
apiVersion: apps/v1
kind: Deployment
metadata:
name: karsajobs-backend
spec:
replicas: 1
selector:
matchLabels:
app: backend
template: