Accessing pandas DataFrame as a nested list
问题 I've used the .set_index() function to set the first column as my index to the rows in my dataframe: >>> import pandas as pd >>> df = pd.DataFrame([['x', 1,2,3,4,5], ['y', 6,7,8,9,10], ['z', 11,12,13,14,15]]) >>> df.columns = ['index', 'a', 'b', 'c', 'd', 'e'] >>> df = df.set_index(['index']) >>> df a b c d e index x 1 2 3 4 5 y 6 7 8 9 10 z 11 12 13 14 15 How should the dataframe be manipulated such that I can be accessed like a nested list? e.g. are the following possible: >>> df['x'] [1, 2