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
# to test this example, make sure you have font Arial Unicode MS(Arial Unicode.ttf) installed. | |
from sklearn.datasets import * | |
from sklearn import tree | |
from dtreeviz.trees import * | |
classifier = tree.DecisionTreeClassifier(max_depth=3) # limit depth of tree | |
iris = load_iris() | |
classifier.fit(iris.data, iris.target) | |
# the following two line codes are just for Chinese test. |
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
[warning] **gettext-0.20.1** | |
uname -a | |
Darwin Stevens-MBP.lan 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64 | |
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1 | |
1ee37f8e0a949f033603a9657f32d81aa1a56e52 - Update packages.json & build-matrix.html [4 hours ago] [ (HEAD -> master, origin/master, origin/HEAD)] | |
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true | |
ProductName: Mac OS X | |
ProductVersion: 10.15.3 | |
BuildVersion: 19D76 | |
autoconf --version 2>/dev/null | head -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
[plugin] /Users/steven/mxe/plugins/native/darwin/ | |
uname -a | |
Darwin Stevens-MacBook-Pro.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64 | |
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1 | |
60b660aae99a4fcdff275f81569cc543aec9f5d3 - Update packages.json & build-matrix.html [6 days ago] [ (HEAD -> master, origin/master, origin/HEAD)] | |
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true | |
ProductName: Mac OS X | |
ProductVersion: 10.15.3 | |
BuildVersion: 19D76 | |
autoconf --version 2>/dev/null | head -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
uname -a | |
Darwin Stevens-MBP.lan 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64 | |
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1 | |
76375b2bccbbf409aaab44d4fc0cbd017c5a00e3 - Update packages.json & build-matrix.html [5 days ago] [ (HEAD -> master, origin/master, origin/HEAD)] | |
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true | |
ProductName: Mac OS X | |
ProductVersion: 10.15.3 | |
BuildVersion: 19D76 | |
autoconf --version 2>/dev/null | head -1 | |
autoconf (GNU Autoconf) 2.69 |
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
import pandas as pd | |
# http://blog.yhathq.com/static/misc/data/WineKMC.xlsx | |
df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0) | |
df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"] | |
df_offers.head() | |
df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1) | |
df_transactions.columns = ["customer_name", "offer_id"] | |
df_transactions['n'] = 1 | |
df_transactions.head() |
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
sudo pip install virtualenvwrapper | |
virtualenv pgadmin4 | |
cd pgadmin4/ | |
source bin/activate | |
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/source/pgadmin4-1.1.tar.gz | |
tar xf pgadmin4-1.1.tar.gz | |
cd pgadmin4-1.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
# -*- coding: utf-8 -*- | |
#encoding=utf-8 | |
import urllib2 | |
import sys, json | |
from StringIO import StringIO | |
import gzip | |
import MySQLdb | |
import datetime |
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
library(readxl, quietly=TRUE) | |
df <- read_excel("d:/my.xlsx",col_names = TRUE) | |
library(RPostgreSQL) | |
drv <- dbDriver("PostgreSQL") | |
con <- dbConnect(drv, user='postgres', password='', dbname='alitrack', host='postgres.alitrack.com') | |
postgresqlpqExec(con, "SET client_encoding = 'GBK'") | |
dbWriteTable(con, c("my_schema","my_table"), data.frame(df), row.names = FALSE) |