Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@messefor
messefor / ggplot2_multi_circle.R
Created January 11, 2017 13:58
ggplot2で同心円状に複数円を描いて、ポイントもプロットする
library(tidyverse)
library(ggrepel)
#-------------------------
# データ作成
#-------------------------
# 円のインデックスとrを指定(r^2が中心からのユークリッド距離)
dist.vec <- c(user1=1, user2=2, user3=3, user4=4)
idx.vec <- names(dist.vec)
@messefor
messefor / 161204_matplotlib_jpfont.md
Last active December 4, 2016 15:21
matplotlib 日本語設定のときに使うコマンド

matplotlib 日本語フォント

日本語設定のときに使うコマンド

# 設定ファイルの場所確認
matplotlib.matplotlib_fname()
#> C:\Users\daisuke.oda\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\mpl-data\matplotlibrc

# システムフォントファイル一覧
@messefor
messefor / excel_pandas.md
Last active December 4, 2016 11:45
Excel Bookからデータをpandasに読み込むメモ

pandas Excel Bookからデータ読み込み

anaconda が入っていれば、特に問題にならない

  • 事前に必要なモジュールをインストール

    $ pip install openpyxl xlrd xlwt
@messefor
messefor / convert_datatype_in_df.R
Last active November 6, 2016 09:11
how to convert each column data type in data.frame
# set function with which convert data into named vector
col.type.f <- c(vane=as.factor,
prefecture=as.factor,
date=as.Date,
time=as.factor,
ts=as.POSIXct)
# convert data type
for (col in names(col.type.f)) {
f.conv <- col.type.f[col][[1]]
# sample of checking package installed and load all.
required.pckg <-
c(
'dummies',
'tidyverse',
'glmnet'
)
not.installed <- !(required.pckg %in% installed.packages()[,'Package'])
if (any(not.installed)) {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.