<jupyter_start><jupyter_text>データアクセス<jupyter_code>ser1 = Series(np.arange(3), index=['A', 'B', 'C'])
ser1 = 2*ser1
ser1
ser1[2]
ser1['C']
ser1[['B', 'C']]
ser1[ser1 < 2]
ser1[ser1 < 3] = 3
ser1
dframe1 = DataFrame(np.arange(25).reshape((5, 5)), index=['LA', 'NF', 'CD', 'TO', 'BF'], columns=['1', '2', '3', '4', '5'])
dframe1
dframe1['3']
dframe1[['1','5']]
dframe1[dframe1['1'] < 11]
dframe1 > 10<jupyter_output><empty_output><jupyter_text>indexアクセス<jupyter_code>dframe1.ix['LA']<jupyter_output><empty_output><jupyter_text>形の違うデータ計算<jupyter_code>ser2 = Series([0,1,2], index=['A','B','C'])
ser3 = Series([3,4,5,6], index=['A','B','C','D'])<jupyter_output><empty_output><jupyter_text>index外はNaNになる<jupyter_code>ser2 + ser3
dframe2 = DataFrame(np.arange(4).reshape((2,2)), index=['NF','BF'], columns=list('AB'))
# list('AB') => ['A','B']
dframe2
dframe3 = DataFrame(np.arange(9).reshape((3,3)), index=['NF','BF','DC'], columns=list('ACD'))
dframe3<jupyter_output><empty_output><jupyter_text>お互いの存在する値のみ足し合わせる(その他はNan)<jupyter_code>dframe2 + dframe3
dframe2.add(dframe3, fill_value=0)
ser4 = dframe2.ix[0]
ser4<jupyter_output><empty_output><jupyter_text>同一ラベルの部分は計算される<jupyter_code>dframe2 - ser4<jupyter_output><empty_output><jupyter_text>データの並べ替えと順番<jupyter_code>ser5 = Series(range(3), index=list('CAB'))
ser5<jupyter_output><empty_output><jupyter_text>indexでソート<jupyter_code>ser5.sort_index()<jupyter_output><empty_output><jupyter_text>中身は変わっていない<jupyter_code>ser5
from numpy.random import randn
ser6 = Series(randn(10))
ser6<jupyter_output><empty_output><jupyter_text>DEPRECATED *order()*<jupyter_code>ser6.order()<jupyter_output>/Users/midori/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages/ipykernel/__main__.py:1: FutureWarning: order is deprecated, use sort_values(...)
  if __name__ == '__main__':<jupyter_text>sort_values() は中身を変化させない<jupyter_code>ser6.sort_values()
ser6.rank()
ser6<jupyter_output><empty_output><jupyter_text>DEPRECATED sort()sort() は中身を変化させる<jupyter_code>ser6.sort()
ser6
# 推奨
ser6.sort_values(inplace=True)
ser6<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20028818443804033, 'fraction_numerical': 0.04755043227665706, 'mean_word_length': 12.525974025974026, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '453117', 'license': 'MIT', 'n_tokens_mistral': 1022, 'n_tokens_neox': 1010, 'n_words': 92, 'path': 'learn/array/pandas_col/pandas_2.ipynb', 'repo_name': 'midorigreen/data-kaggle', 'size': '2082'}