Is it possible when creating a dataframe from a list, to set the index as one of the values?
import pandas as pd
tmp = [['a', 'a1'], ['b',' b1']]
df = pd.DataFrame(tmp, columns=["First", "Second"])
First Second
0 a a1
1 b b1
And how I'd like it to look:
First Second
a a a1
b b b1
df.index = df.Firstdf.set_index('col_name', inplace=True), if you would like to use an external object like list, pd.Series as your index instead opt-2:df.index = list_1