概要 書いていて長くなったため、まず前編として pandas で データを行 / 列から選択する方法を少し詳しく書く。特に、個人的にはけっこう重要だと思っている loc と iloc について 日本語で整理したものがなさそうなので。 サンプルデータの準備 import pandas as pd s = pd.Series([1, 2, 3], index = ['I1', 'I2', 'I3']) df = pd.DataFrame({'C1': [11, 21, 31], 'C2': [12, 22, 32], 'C3': [13, 23, 33]}, index = ['I1', 'I2', 'I3']) s # I1 1 # I2 2 # I3 3 # dtype: int64 df # C1 C2 C3 # I1 11 12 13 # I2 21 22 23 # I3 31 32
![Python pandas データ選択処理をちょっと詳しく <前編> - StatsFragments](https://cdn-ak-scissors.b.st-hatena.com/image/square/72b8840c381c610129b7e53087b6e3ccb9645672/height=288;version=1;width=512/http%3A%2F%2Fecx.images-amazon.com%2Fimages%2FI%2F51Y8KNTSc1L.jpg)