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
# ------------------------------------------------------------------------- | |
# ------------------------------------------------------------------------- | |
# Seaborn Bar Chart with Annotations | |
# ------------------------------------------------------------------------- | |
# ------------------------------------------------------------------------- | |
import matplotlib.pyplot as plt | |
import seaborn as sns; | |
sns.set(style="whitegrid", color_codes=True) | |
%matplotlib inline |
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
# ------------------------------------------------------------------------- | |
# ------------------------------------------------------------------------- | |
# Matplotlib Twin Axis Plots | |
# Description: plot histogram and line chart together in a dual-axis approach | |
# ------------------------------------------------------------------------- | |
# ------------------------------------------------------------------------- | |
import matplotlib.pyplot as plt | |
import seaborn as sns; | |
sns.set(style="whitegrid", color_codes=True) | |
%matplotlib inline |
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
print(sc) | |
print(spark) | |
# <pyspark.sql.session.SparkSession at 0x7f8df8673ba8> | |
# ------------------------------------------------------------------------------- | |
# Import PySpark Libraries | |
# ------------------------------------------------------------------------------- | |
import datetime | |
from datetime import datetime | |
from pyspark.sql.functions import skewness, kurtosis |
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
#------------------------------------------------------------------------------------------------------------------- | |
# Load standard libraries | |
# ------------------------------------------------------------------------------------------------------------------ | |
import os | |
import pandas as pd | |
import numpy as np | |
import tqdm | |
import warnings | |
warnings.filterwarnings('ignore') | |
from datetime import timedelta |
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
#------------------------------------------------------------------------------------------------------------------- | |
# Load standard libraries | |
# ------------------------------------------------------------------------------------------------------------------ | |
import os | |
import pandas as pd | |
import numpy as np | |
import tqdm | |
import warnings | |
warnings.filterwarnings('ignore') | |
from datetime import timedelta |
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
print('https://stackoverflow.com/questions/26455616/how-can-i-create-basic-timestamps-or-dates-python-3-4') | |
import datetime | |
print('Timestamp: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now())) | |
print('Timestamp: {:%Y-%b-%d %H:%M:%S}'.format(datetime.datetime.now())) | |
print('Date now: %s' % datetime.datetime.now()) | |
print('Date today: %s' % datetime.date.today()) | |
today = datetime.date.today() |
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
# -------------------------------------------------------- | |
# Typical for Loop in R | |
# -------------------------------------------------------- | |
total <- 10 | |
for(i in 1:total){ | |
print(i) | |
Sys.sleep(0.1) | |
} |
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
print(sc) | |
print(spark) | |
# <pyspark.sql.session.SparkSession at 0x7f8df8673ba8> | |
# ------------------------------------------------------------------------------- | |
# Import PySpark Libraries | |
# ------------------------------------------------------------------------------- | |
import datetime | |
from datetime import datetime | |
from pyspark.sql.functions import skewness, kurtosis |
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
# load package | |
library(stringr) | |
# prepare the exercises data | |
addresses <- c("14 Pine Street, Los Angeles", "152 Redwood Street, Seattle", "8 Washington Boulevard, New York") | |
products <- c("TV ", " laptop", "portable charger", "Wireless Keybord", " HeadPhones ") | |
long_sentences <- stringr::sentences[1:10] | |
field_names <- c("order_number", "order_date", "customer_email", "product_title", "amount") | |
employee_skills <- c("John Bale (Beginner)", "Rita Murphy (Pro)", "Chris White (Pro)", "Sarah Reid (Medium)") |
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
# load packages | |
library(shiny) | |
library(shinydashboard) | |
#################### | |
# # | |
# Exercise 1 # | |
# # | |
#################### | |
header <- dashboardHeader( |