If I have an existing pandas dataframe, is there a way to generate the python code, which when executed in another python script, will reproduce that dataframe.
e.g.
You could try to use the to_dict() method on DataFrame:
print "df = pd.DataFrame( %s )" % (str(df.to_dict()))
If your data contains NaN's, you'll have to replace them with float('nan'):
print "df = pd.DataFrame( %s )" % (str(df.to_dict()).replace(" nan"," float('nan')"))