Skip to content
Browse files

TST: add vbench for drop_duplicates, speed up panel_ctors, GH #558

  • Loading branch information...
1 parent 18ca639 commit 06909062285b6dbab247346577d0e82e5f1e5d6a @wesm wesm committed Jan 9, 2012
Showing with 13 additions and 7 deletions.
  1. +6 −6 vb_suite/panel_ctor.py
  2. +7 −1 vb_suite/reindex.py
View
12 vb_suite/panel_ctor.py
@@ -10,10 +10,10 @@
START_DATE = datetime(2011, 6, 1)
setup_same_index = common_setup + """
-# create 1000 dataframes with the same index
+# create 100 dataframes with the same index
dr = np.asarray(DateRange(datetime(1990,1,1), datetime(2012,1,1)))
data_frames = {}
-for x in xrange(1000):
+for x in xrange(100):
df = DataFrame({"a": [0]*len(dr), "b": [1]*len(dr),
"c": [2]*len(dr)}, index=dr)
data_frames[x] = df
@@ -26,7 +26,7 @@
setup_equiv_indexes = common_setup + """
data_frames = {}
-for x in xrange(1000):
+for x in xrange(100):
dr = np.asarray(DateRange(datetime(1990,1,1), datetime(2012,1,1)))
df = DataFrame({"a": [0]*len(dr), "b": [1]*len(dr),
"c": [2]*len(dr)}, index=dr)
@@ -42,7 +42,7 @@
data_frames = {}
start = datetime(1990,1,1)
end = datetime(2012,1,1)
-for x in xrange(1000):
+for x in xrange(100):
end += timedelta(days=1)
dr = np.asarray(DateRange(start, end))
df = DataFrame({"a": [0]*len(dr), "b": [1]*len(dr),
@@ -59,8 +59,8 @@
data_frames = {}
start = datetime(1990,1,1)
end = datetime(2012,1,1)
-for x in xrange(1000):
- if x == 500:
+for x in xrange(100):
+ if x == 50:
end += timedelta(days=1)
dr = np.asarray(DateRange(start, end))
df = DataFrame({"a": [0]*len(dr), "b": [1]*len(dr),
View
8 vb_suite/reindex.py
@@ -110,7 +110,7 @@ def backfill():
#----------------------------------------------------------------------
-# sort_index
+# sort_index, drop_duplicates
# pathological, but realistic
setup = common_setup + """
@@ -128,3 +128,9 @@ def backfill():
name='frame_sort_index_by_columns',
start_date=datetime(2011, 11, 1))
+# drop_duplicates
+
+statement = "df.drop_duplicates(['key1', 'key2'])"
+frame_drop_duplicates = Benchmark(statement, setup,
+ name='frame_drop_duplicates',
+ start_date=datetime(2011, 11, 15))

0 comments on commit 0690906

Please sign in to comment.
Something went wrong with that request. Please try again.