Skip to content

Instantly share code, notes, and snippets.

View benadaba's full-sized avatar

Bernard Antwi Adabankah benadaba

  • London
View GitHub Profile
@benadaba
benadaba / PublicProtectedPrivate.ipynb
Last active September 8, 2018 14:49
Public Protected Private Variables
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benadaba
benadaba / PredictIncomeLevel_Azure.ipynb
Last active July 24, 2018 22:51
Predict Income Level Using Microsoft Azure And Consume The Model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
""" Small script that shows hot to do one hot encoding
of categorical columns in a pandas DataFrame.
See:
http://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.OneHotEncoder.html#sklearn.preprocessing.OneHotEncoder
http://scikit-learn.org/dev/modules/generated/sklearn.feature_extraction.DictVectorizer.html
"""
import pandas
import random
@benadaba
benadaba / Get Number and percentages.sql
Created October 2, 2016 23:12
Get Number and percentages - Microsoft Sql Server
/****** Script for SelectTopNRows command from SSMS ******/
SELECT count(*) as [# Bookings],
ROUND((cast(Count([Flight Booking ID])* 100 as FLOAT) / (Select Count(*) From [Antrak].[dbo].[FlightBookingsMain] where isCancelled <> 'false')), 2) as [% Booking],
datename(dw, [Booking Date]) as [Most Popular Day]
FROM [Antrak].[dbo].[FlightBookingsMain]
where isCancelled <> 'false'
group by datename(dw, [Booking Date])
order by [# Bookings] desc
@benadaba
benadaba / financialYearIncrementor.py
Last active September 29, 2016 07:24
Financial Year Dates Incrementor
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 22:17:41 2016
@author: adaba
"""
import datetime
from calendar import monthrange
from dateutil.parser import parse
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benadaba
benadaba / Ex 5 Teradata Dillard.sql
Created May 8, 2016 04:33
Ex 5 Teradata Dillard.sql
/*(a) rows in the trsnact table that have “0” in their orgprice column (how could the
--original price be 0?), */
SELECT *
FROM TRNSACT
WHERE ORGPRICE = 0;
-- (b) rows in the skstinfo table where both the cost and retail price are listed as 0.00,
@benadaba
benadaba / Ex 4 Teradata Dillard.sql
Created May 8, 2016 04:26
Ex 4 Teradata Dillard.sql
--Ex4
SELECT *
FROM TRNSACT
WHERE AMT <> SPRICE;
@benadaba
benadaba / Teradata Look at Raw Data.sql
Created May 8, 2016 04:15
Teradata Sql Scratchpad - Look at Raw Data.sql
SELECT *
FROM deptinfo
SAMPLE 10
ORDER BY dept ASC;
SELECT TOP 50 *
FROM skstinfo;
SELECT TOP 10*
FROM skstinfo_fix;
@benadaba
benadaba / Teradata HELP and SHOW.sql
Last active May 8, 2016 04:22
Teradata HELP and SHOW to know about data.sql
HELP TABLE deptinfo;
SHOW TABLE deptinfo;
HELP TABLE skstinfo;
SHOW TABLE skstinfo;
HELP TABLE skstinfo_fix;
SHOW TABLE skstinfo_fix;
HELP TABLE skuinfo;