multiindex
-
[pandas] Multi index에서 single index로, Multi column에서 single column으로 코드 한줄로 변경하기python/pandas 2021. 6. 23. 10:54
In [5]: import numpy as np import pandas as pd 인덱스를 생성하기 위한 array를 생성¶ In [3]: arrays = [ np.array(["bar", "bar", "baz", "baz", "foo", "foo", "qux", "qux"]), np.array(["one", "two", "one", "two", "one", "two", "one", "two"])] arrays를 index로 하는 DataFrame을 생성한다.¶ In [6]: df = pd.DataFrame(np.random.randn(8, 4), index=arrays) In [7]: df Out[7]: 0 1 2 3 bar one -0.855668 1.135211 2.552778 -1.380448 ..