2015-04-10から1日間の記事一覧

<Python> format文

ここに詳しく書いてある。 助かる。 [python]文字列フォーマットまとめ(format関数, %dなど) - dackdive's blogdackdive.hateblo.jp

<Python, pandas> カラムがあるか? と カラムの追加の仕方。

カラムcolumnsにその名前があるか?の判定方法と、 空のカラムcolumnsの追加の仕方。 In [81]: a = pd.DataFrame(data=[[1,2,3],[4,5,6]], columns=['a','b','c']) In [82]: a Out[82]: a b c 0 1 2 3 1 4 5 6 In [83]: if not 'd' in a.columns: print('Y')…

<Python, pandas> pivot_tableの使い方とプロット。

過去メモもあるが改めてメモメモ。 In [74]: import pandas as pd In [75]: import numpy as np In [76]: df = pd.DataFrame({'A' : ['one', 'one', 'two', 'three'] * 6, ...: 'B' : ['A', 'B', 'C'] * 8, ...: 'C' : ['foo', 'foo', 'foo', 'bar', 'bar', …