How to deal with date and time in SQLite

Motivation When dealing with databases you will need the ability to store certain dates and/or timestamps in your tables. Let’s find out how you can do that in an SQLite database. SQL table creation SQLite has the data type TIMESTAMP for storing date-times CREATE TABLE social_media ( social_media_id INTEGER, insertion_date TIMESTAMP, yt_subs INTEGER fb_pg INTEGER…

SQL-Tutorial

I really like SQL. But sometimes I struggle to undestand some of the concepts. So I write about it. Meanwhile there are a bunch of articles, so time for a overview page: SQL-Basics: Create, Read, Update & Delete SQL-Basics: Relations SQL-Functions – SQL-Basics 3 SQLite3: Python and SQL Subqueries: Update column with values from another…

New Blog Post

k-fold crossvalidation with sklearn

from sklearn.model_selection import KFold kf = KFold(n_splits=2) kf.split(df_train) step = 0 # set counter to 0 for train_index, val_index in kf.split(df_train): # for each fold step = step + 1 # update counter print(‘Step ‘, step) features_fold_train = df_train.iloc[train_index, [4, 5]] # features matrix of training data (of this step) features_fold_val = df_train.iloc[val_index, [4, 5]]…

Pandas Cheat Sheet

If you are new to Pandas feel free to read Introduction to Pandas I’ve assembled some pandas code snippets Reading Data Reading CSV import pandas as pd # read from csv df = pd.read_csv(“path_to_file”) Can also be textfiles. file suffix is ignored The default limiter for comma separated value files is the comma. If you…

Data Science Pipeline

Motivation Learning Data Science can be grueling and overwhelming sometimes. When I feel too overwhelmed it’s time to draw a picture. This my current overview of what a data scientist has to do: General tools Linear Algebra with numpy numpy random choice Numpy linspace function Data acquisiton Data Science Datasets: Iris flower data set Data…