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
【問題設定】 | |
データ欠落日のある日次データオブジェクトに、欠落日の行(年月日列以外のカラム値 0ゼロ)を一括挿入するR言語スクリプト | |
(データ例) | |
<データ期間> 1980年1月1日~2013年12月31日 | |
<データ欠落日> 1980年1月1日, 1980年1月2日,1980年1月7日, 1980年1月8日,1980年1月9日・・・ | |
<データ形式> (1列目) YYYY-MM-DD , (2列目) 数値 ※カンマ区切り | |
【欠落行(欠落日のデータ行)を一括挿入する方法】 |
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
Qiita アップロード先 URL | |
http://qiita.com/HirofumiYashima/items/f2b39ca1556c809e00d3 | |
#### ウェブサイト「日経平均プロフィル 日経の指数情報サイト」で公開されている日経平均株価の日次データファイルをRに取り込む | |
address <- "http://indexes.nikkei.co.jp/nkave/historical/nikkei_stock_average_daily_jp.csv" | |
nikkei225 <- read.csv(file=url(address), header=TRUE, sep=",") | |
#### データの冒頭を確認。 |
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
[x if type(x)!=int else x**2 for x in data_list_2] |
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
from decimal import Decimal | |
import types | |
data_lit_3 = [0.01, 0.07, 'NULL', 0.08, 'na', ''] | |
['%g%%' % y if type(y)==Decimal else y for y in [Decimal(str(x))*Decimal('100') if type(x)==float else x for x in data_list_3]] | |
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
[a+b+c+d for (a, b, c,d) in zip(list1, list2, list3, list4)] |
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
1-1.(例)数学(「圏論」)の世界構造をコードに表現できる関数型言語を極めたい | |
1-2. アーティスト向けの言語、Processing で、グラフィカルな表現を愉しみたい | |
1-3.メモリ容量には制約があるけど、手元の小さなデータで、最新の機械学習・データ解析のアルゴリズム提唱論文を実装できる、R 言語であれこれデータの挙動を試したい |
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
filter(None, [1,2,3,None]) | |
sum(filter(None, [1,2,3,None])) |
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
#!/Usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import smtplib | |
from email.mime.text import MIMEText | |
class sendGmail: | |
username, password = 'hirofumi.yashima2012@gmail.com', 'XXXXX' | |
def __init__(self, to, sub, body): |
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 find .profile |
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
[x for x in str_date_list] |
OlderNewer