×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: Pablo Vasquez
Added: Aug 18, 2016 9:27 PM
Modified: Aug 30, 2016 4:49 PM
Views: 13
Tags: pnadas
xample of Pandas dataframe using dicts and for loops
  1. import pandas as pd
  2.  
  3.  
  4. mf = pd.DataFrame({"x0": [], "x1": [], "y0": [], "y1": [], "m": [], "b": [], "y_0": [],
  5.                    "y_1": [], "etot": []}, columns=['x0', 'x1', 'y0', 'y1', 'm', 'b', 'y_0', 'y_1',
  6.                                                     'etot'])
  7. mf.loc[i] = [x[0], x[1], y[0], y[1], m, b, y_0, y_1, etotal[i]]
  8.  
  9. cmf= mf[mf["Viaparto"]=='Cesarea']
  10. vmf= mf[mf["Viaparto"]=='Vaginal']
  11. s =mf.mean(axis=0)
  12.