dgadiraju
7/27/2017 - 12:08 AM

python_dataframes_dict.py

import pandas as pd
data = {'order_id' : [1, 2],
  'order_date' : ['2014-01-01 00:00:00', '2014-01-01 00:00:00'],
  'order_customer_id' : [1, 1],
  'order_status' : ['COMPLETE', 'CLOSED']
}

df = pd.DataFrame(data, columns = ['order_id', 'order_date', 'order_customer_id', 'order_status'])

#Accessing by column
df.order_id

#Accessing by row index
df.iloc[[1]]

#Setting index
df1 = df.set_index(df.order_id)