一つのカラムから、複数カラムへ分割する
date --> [day, month, year]
のカラムに変更。 expand=true
にして、rename
すればいい。
date 02.01.2013
transactions[['day', 'month', 'year']] = transactions.date.str.split( '.', 2, expand=True ).rename(columns = {0:'day', 1:'month', 2:'year' })
kibana に index登録
PUT /index { "mappings": { "doc": { "properties": { "id": {"type": "integer"}, "count": {"type": "integer"} } } } } GET /_cat/indices?v
$ grep -rF 'pipeline.workers' config/logstash.yml # pipeline.workers: 2 pipeline.workers: 1
- csv_pipeline.conf
input { file { path => "/path/..." start_position => "beginning" sincedb_path => "/dev/null" } } # The filter part of this file is commented out to indicate that it is # optional. filter { csv { separator => "," remove_field => [ "path", "message", "host", "@timestamp", "@version" ] columns => } } output { elasticsearch { hosts => [ "localhost:9200" ] index => "index" } }
コマンド履歴をhistoryに残さない
history のコマンド履歴を消す。
echo 'a' echo 'b' echo 'c' set +o history echo 'd' set -o history history | tail -4
- 出力結果
685 echo 'b' 686 echo 'c' 687 set +o history 688 history | tail -4
標本平均と不偏標本分散とか信頼区間をpythonでする
train.loc[train.paytype == 1, :].pa.sum() # pa人数 # cash (paytype=1) で払った人 train_iscash = train.paytype == 1 # cash 出払った人の割合の平均値の信頼区間 99% from statsmodels.stats.proportion import proportion_confint proportion_confint(sum(train_iscash), len(train_iscash), alpha=0.01) # 信頼区間 (0.314, 0.315) # distance = 距離 # 標本平均 train['distance'].mean() # 不偏標本分散 s = train['distance'].std(ddof=1) / np.sqrt(len(train['distance']) - 1) # distance の信頼区間 95% <-- Nが大きいため、正規分布に近似している from statsmodels.stats.weightstats import _tconfint_generic _tconfint_generic(train['distance'].mean(), s, len(train['distance']), 0.05, 'two-sided') (3.14, 3.15)
kibana を公開するには、HTMLにiframeで埋め込めば良さそう
iframe で 埋め込めば対応可能。
あと、chromeでいろいろ確認するには、Elements を直接いじれば良さそう。
MySQL の admin user以外で、ログインできなかった話
管理者権限のないuserでログインするとできなかった。
どうやら、MySQL5.7では、plugin を mysql_native_password にしないとパスワードなしログインはできないデフォルトらしい。
$ mysql -uroot ERROR 1698 (28000): Access denied for user 'root'@'localhost'
mysql> use mysql mysql> select Host,User,plugin from user limit 1; +-----------+------+-----------------------+ | Host | User | plugin | +-----------+------+-----------------------+ | localhost | root | auth_socket | +-----------+------+-----------------------+ 1 row in set (0.00 sec) mysql> update user set plugin='mysql_native_password' where User='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 2 Changed: 1 Warnings: 0 mysql> select Host,User,plugin from user limit 1; +-----------+------+-----------------------+ | Host | User | plugin | +-----------+------+-----------------------+ | localhost | root | mysql_native_password | +-----------+------+-----------------------+ 1 row in set (0.00 sec)