In pandas, the melt function is similar:
In [55]: sample_4_df=flights_sample_df[['year','month','dep_delay', 'arr_delay']].head(4) In [56]: sample_4_df Out[56]: year month dep_delayarr_delay 0 2013 3 2 5 1 2013 1 0 4 2 2013 11 -7 -27 3 2013 5 -5 -12 In [59]: pd.melt(sample_4_df,id_vars=['year','month']) Out[59]: year month variable value 0 2013 3 dep_delay 2 1 2013 1 dep_delay 0 2 2013 11 dep_delay -7 3 2013 5 dep_delay -5 4 2013 3 arr_delay 5 5 2013 1 arr_delay 4 6 2013 11 arr_delay -27 7 2013 5 arr_delay -12
The reference source for this information is as follows: http://pandas.pydata.org/pandas-docs/stable/reshaping.html#reshaping-by-melt.