User Tools

Site Tools


data:pandas:allign

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
data:pandas:allign [2018/04/03 20:44] – aistisdata:pandas:allign [2018/04/03 20:45] (current) – aistis
Line 5: Line 5:
 start = time.time() start = time.time()
 for q in d: for q in d:
-    df1.iloc[np.in1d(all_date, q.date, assume_unique=True), df1.columns.get_loc(q.sidb)] = q.pnl+    df1.iloc[np.in1d(all_date, q.date, assume_unique=True),  
 +       df1.columns.get_loc(q.sidb)] = q.pnl
 print ("Result: %.2f secs" % (time.time() - start)) print ("Result: %.2f secs" % (time.time() - start))
 </code> </code>
Line 11: Line 12:
  
 allign data in numpy array (3x faster) allign data in numpy array (3x faster)
 +<code python>
 # allign using numpy # allign using numpy
 start = time.time() start = time.time()
Line 20: Line 22:
     i = i + 1     i = i + 1
 print ("Result: %.2f secs" % (time.time() - start)) print ("Result: %.2f secs" % (time.time() - start))
 +</code>
  
  
data/pandas/allign.1522777475.txt.gz · Last modified: by aistis