Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
TST: add vbench for drop_duplicates, speed up panel_ctors, GH #558
  • Loading branch information
wesm committed Jan 10, 2012
1 parent 18ca639 commit 0690906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 6 additions & 6 deletions vb_suite/panel_ctor.py
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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),
Expand All @@ -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),
Expand Down
8 changes: 7 additions & 1 deletion vb_suite/reindex.py
Expand Up @@ -110,7 +110,7 @@ def backfill():


#----------------------------------------------------------------------
# sort_index
# sort_index, drop_duplicates

# pathological, but realistic
setup = common_setup + """
Expand All @@ -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.