31
31
except:
32
32
pass
33
33
34
- df = DataFrame({'data1' : np.random.randn(100000),
34
+ df = pd. DataFrame({'data1' : np.random.randn(100000),
35
35
'data2' : np.random.randn(100000),
36
36
'key1' : key1,
37
37
'key2' : key2})
38
38
39
39
40
- df_key1 = DataFrame(np.random.randn(len(level1), 4), index=level1,
40
+ df_key1 = pd. DataFrame(np.random.randn(len(level1), 4), index=level1,
41
41
columns=['A', 'B', 'C', 'D'])
42
- df_key2 = DataFrame(np.random.randn(len(level2), 4), index=level2,
42
+ df_key2 = pd. DataFrame(np.random.randn(len(level2), 4), index=level2,
43
43
columns=['A', 'B', 'C', 'D'])
44
44
45
45
df_shuf = df.reindex(df.index[shuf])
69
69
#----------------------------------------------------------------------
70
70
# Joins on integer keys
71
71
setup = common_setup + """
72
- df = DataFrame({'key1': np.tile(np.arange(500).repeat(10), 2),
72
+ df = pd. DataFrame({'key1': np.tile(np.arange(500).repeat(10), 2),
73
73
'key2': np.tile(np.arange(250).repeat(10), 4),
74
74
'value': np.random.randn(10000)})
75
- df2 = DataFrame({'key1': np.arange(500), 'value2': randn(500)})
75
+ df2 = pd. DataFrame({'key1': np.arange(500), 'value2': randn(500)})
76
76
df3 = df[:5000]
77
77
"""
78
78
96
96
key = np.tile(indices[:8000], 10)
97
97
key2 = np.tile(indices2[:8000], 10)
98
98
99
- left = DataFrame({'key' : key, 'key2':key2,
99
+ left = pd. DataFrame({'key' : key, 'key2':key2,
100
100
'value' : np.random.randn(80000)})
101
- right = DataFrame({'key': indices[2000:], 'key2':indices2[2000:],
101
+ right = pd. DataFrame({'key': indices[2000:], 'key2':indices2[2000:],
102
102
'value2' : np.random.randn(8000)})
103
103
"""
104
104
112
112
# Appending DataFrames
113
113
114
114
setup = common_setup + """
115
- df1 = DataFrame(np.random.randn(10000, 4), columns=['A', 'B', 'C', 'D'])
115
+ df1 = pd. DataFrame(np.random.randn(10000, 4), columns=['A', 'B', 'C', 'D'])
116
116
df2 = df1.copy()
117
117
df2.index = np.arange(10000, 20000)
118
118
mdf1 = df1.copy()
@@ -180,7 +180,7 @@ def sample(values, k):
180
180
start_date = datetime (2012 , 2 , 27 ))
181
181
182
182
setup = common_setup + """
183
- df = DataFrame(randn(5, 4))
183
+ df = pd. DataFrame(randn(5, 4))
184
184
"""
185
185
186
186
concat_small_frames = Benchmark ('concat([df] * 1000)' , setup ,
@@ -191,8 +191,8 @@ def sample(values, k):
191
191
# Concat empty
192
192
193
193
setup = common_setup + """
194
- df = DataFrame(dict(A = range(10000)),index=date_range('20130101',periods=10000,freq='s'))
195
- empty = DataFrame()
194
+ df = pd. DataFrame(dict(A = range(10000)),index=date_range('20130101',periods=10000,freq='s'))
195
+ empty = pd. DataFrame()
196
196
"""
197
197
198
198
concat_empty_frames1 = Benchmark ('concat([df,empty])' , setup ,
@@ -207,11 +207,11 @@ def sample(values, k):
207
207
setup = common_setup + """
208
208
groups = tm.makeStringIndex(10).values
209
209
210
- left = DataFrame({'group': groups.repeat(5000),
210
+ left = pd. DataFrame({'group': groups.repeat(5000),
211
211
'key' : np.tile(np.arange(0, 10000, 2), 10),
212
212
'lvalue': np.random.randn(50000)})
213
213
214
- right = DataFrame({'key' : np.arange(10000),
214
+ right = pd. DataFrame({'key' : np.arange(10000),
215
215
'rvalue' : np.random.randn(10000)})
216
216
217
217
"""
@@ -242,10 +242,10 @@ def sample(values, k):
242
242
np.random.seed(2718281)
243
243
n = 50000
244
244
245
- left = DataFrame(np.random.randint(1, n/500, (n, 2)),
245
+ left = pd. DataFrame(np.random.randint(1, n/500, (n, 2)),
246
246
columns=['jim', 'joe'])
247
247
248
- right = DataFrame(np.random.randint(1, n/500, (n, 2)),
248
+ right = pd. DataFrame(np.random.randint(1, n/500, (n, 2)),
249
249
columns=['jolie', 'jolia']).set_index('jolie')
250
250
'''
251
251
@@ -255,7 +255,7 @@ def sample(values, k):
255
255
256
256
setup = common_setup + """
257
257
low, high, n = -1 << 10, 1 << 10, 1 << 20
258
- left = DataFrame(np.random.randint(low, high, (n, 7)),
258
+ left = pd. DataFrame(np.random.randint(low, high, (n, 7)),
259
259
columns=list('ABCDEFG'))
260
260
left['left'] = left.sum(axis=1)
261
261
0 commit comments