Skip to content

Instantly share code, notes, and snippets.

#import needed package
import pandas as pd
#read file and create dataframe
df = pd.read_csv(r"file_path.csv", encoding= 'unicode_escape')
df.head() #view head of dataframe
#convert timestamp/datetime/etc column... from object (or other) datatype to datetime datatype if needed.
#longest process in this script if needed, otherwise ignore.
df['timestamp'] = df['timestamp'].apply(pd.Timestamp)
@vipassanaecon
vipassanaecon / ISL - simple regression analysis.ipynb
Created January 21, 2022 22:30
ISL - simple regression analysis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vipassanaecon
vipassanaecon / advertising.csv
Last active January 21, 2022 20:11
advertising.csv
tv sales
230.1 22.1
44.5 10.4
17.2 9.3
151.5 18.5
180.8 12.9
8.7 7.2
57.5 11.8
120.2 13.2
8.6 4.8
@vipassanaecon
vipassanaecon / simple_linear_regression_food.ipynb
Last active January 23, 2022 02:38
simple_linear_regression_food
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vipassanaecon
vipassanaecon / food.csv
Last active January 21, 2022 20:10
food.csv
food_exp income
115.22 3.69
135.98 4.39
119.34 4.75
114.96 6.03
187.05 12.47
243.92 12.98
267.43 14.2
238.71 14.76
295.94 15.32
@vipassanaecon
vipassanaecon / Update example script 3.sql
Last active January 4, 2022 23:16
Update example script 3
-- Update example script 3 (final)
update region_table
set isopen = 'Y'
, isavailable = 'N'
, isrestricted = 'Y'
, user_last_modified = 'user_migration'
, date_last_modified = sysdate
where state_plan_id = (
select table_id
from state_table st
@vipassanaecon
vipassanaecon / Update example script 2.sql
Last active January 4, 2022 23:16
Update example script 2
-- Update example script 2
"update region_table
set isopen = 'Y'
, isavailable = 'N'
, isrestricted = 'Y'
, user_last_modified = 'user_migration'
, date_last_modified = sysdate
where state_plan_id = (
select table_id
from state_table st
@vipassanaecon
vipassanaecon / Update example script 1.sql
Last active January 4, 2022 23:14
Update example script 1
-- Update example script 1
= "update region_table
set isopen = 'Y' "&"
, isavailable = 'N'
, isrestricted = 'Y'
, user_last_modified = 'user_migration'
, date_last_modified = sysdate
where state_plan_id = (
select table_id "&"
from state_table st
@vipassanaecon
vipassanaecon / red_wine_excel_example_two.sql
Last active December 30, 2021 22:39
SQL for medium article 2
CREATE TABLE IF NOT EXISTS red_wine
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
fixed_acidity REAL NOT NULL,
volatile_acidity REAL NOT NULL,
citric_acid REAL NOT NULL,
residual_sugar REAL NOT NULL,
chlorides REAL NOT NULL,
free_sulfur_dioxide INTEGER NOT NULL,
total_sulfur_dioxide INTEGER NOT NULL,
@vipassanaecon
vipassanaecon / red_wine_excel_example_one.sql
Last active December 30, 2021 22:33
SQL for medium article 1
CREATE TABLE IF NOT EXISTS red_wine
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
fixed_acidity REAL NOT NULL,
volatile_acidity REAL NOT NULL,
citric_acid REAL NOT NULL,
residual_sugar REAL NOT NULL,
chlorides REAL NOT NULL,
free_sulfur_dioxide INTEGER NOT NULL,
total_sulfur_dioxide INTEGER NOT NULL,