|
19 | 19 | setup = common_setup + """
|
20 | 20 | index = [rands(10) for _ in xrange(10000)]
|
21 | 21 | df = DataFrame({'float1' : randn(10000),
|
22 |
| - 'float2' : randn(10000), |
23 |
| - 'string1' : ['foo'] * 10000, |
24 |
| - 'bool1' : [True] * 10000, |
25 |
| - 'int1' : np.random.randint(0, 100000, size=10000)}, |
26 |
| - index=index) |
| 22 | + 'float2' : randn(10000), |
| 23 | + 'string1' : ['foo'] * 10000, |
| 24 | + 'bool1' : [True] * 10000, |
| 25 | + 'int1' : np.random.randint(0, 100000, size=10000)}, |
| 26 | + index=index) |
27 | 27 | """
|
28 | 28 |
|
29 | 29 | sql_write_sqlalchemy = Benchmark("df.to_sql('test1', engine, if_exists='replace')",
|
|
39 | 39 | setup = common_setup + """
|
40 | 40 | index = [rands(10) for _ in xrange(10000)]
|
41 | 41 | df = DataFrame({'float1' : randn(10000),
|
42 |
| - 'float2' : randn(10000), |
43 |
| - 'string1' : ['foo'] * 10000, |
44 |
| - 'bool1' : [True] * 10000, |
45 |
| - 'int1' : np.random.randint(0, 100000, size=10000)}, |
46 |
| - index=index) |
| 42 | + 'float2' : randn(10000), |
| 43 | + 'string1' : ['foo'] * 10000, |
| 44 | + 'bool1' : [True] * 10000, |
| 45 | + 'int1' : np.random.randint(0, 100000, size=10000)}, |
| 46 | + index=index) |
47 | 47 | df.to_sql('test2', engine, if_exists='replace')
|
48 | 48 | df.to_sql('test2', con, if_exists='replace')
|
49 | 49 | """
|
|
63 | 63 |
|
64 | 64 | setup = common_setup + """
|
65 | 65 | df = DataFrame({'float' : randn(10000),
|
66 |
| - 'string' : ['foo'] * 10000, |
67 |
| - 'bool' : [True] * 10000, |
68 |
| - 'datetime' : date_range('2000-01-01', periods=10000, freq='s')}) |
| 66 | + 'string' : ['foo'] * 10000, |
| 67 | + 'bool' : [True] * 10000, |
| 68 | + 'datetime' : date_range('2000-01-01', periods=10000, freq='s')}) |
69 | 69 | df.loc[1000:3000, 'float'] = np.nan
|
70 | 70 | """
|
71 | 71 |
|
|
74 | 74 | setup, start_date=sdate)
|
75 | 75 |
|
76 | 76 | sql_float_write_fallback = \
|
77 |
| - Benchmark("df[['float']].to_sql('test_float', con, if_exists='replace')", |
| 77 | + Benchmark("df[['float']].to_sql('test_float', con, if_exists='replace')", |
78 | 78 | setup, start_date=sdate)
|
79 | 79 |
|
80 | 80 | sql_string_write_sqlalchemy = \
|
81 |
| - Benchmark("df[['string']].to_sql('test_string', engine, if_exists='replace')", |
| 81 | + Benchmark("df[['string']].to_sql('test_string', engine, if_exists='replace')", |
82 | 82 | setup, start_date=sdate)
|
83 | 83 |
|
84 | 84 | sql_string_write_fallback = \
|
85 |
| - Benchmark("df[['string']].to_sql('test_string', con, if_exists='replace')", |
86 |
| - setup, start_date=sdate) |
| 85 | + Benchmark("df[['string']].to_sql('test_string', con, if_exists='replace')", |
| 86 | + setup, start_date=sdate) |
87 | 87 |
|
88 | 88 | sql_datetime_write_sqlalchemy = \
|
89 |
| - Benchmark("df[['datetime']].to_sql('test_datetime', engine, if_exists='replace')", |
90 |
| - setup, start_date=sdate) |
| 89 | + Benchmark("df[['datetime']].to_sql('test_datetime', engine, if_exists='replace')", |
| 90 | + setup, start_date=sdate) |
91 | 91 |
|
92 | 92 | #sql_datetime_write_fallback = \
|
93 |
| -# Benchmark("df[['datetime']].to_sql('test_datetime', con, if_exists='replace')", |
94 |
| -# setup3, start_date=sdate) |
| 93 | +# Benchmark("df[['datetime']].to_sql('test_datetime', con, if_exists='replace')", |
| 94 | +# setup3, start_date=sdate) |
95 | 95 |
|
96 | 96 | #-------------------------------------------------------------------------------
|
97 | 97 | # type specific read
|
98 | 98 |
|
99 | 99 | setup = common_setup + """
|
100 | 100 | df = DataFrame({'float' : randn(10000),
|
101 |
| - 'datetime' : date_range('2000-01-01', periods=10000, freq='s')}) |
| 101 | + 'datetime' : date_range('2000-01-01', periods=10000, freq='s')}) |
102 | 102 | df['datetime_string'] = df['datetime'].map(str)
|
103 | 103 |
|
104 | 104 | df.to_sql('test_type', engine, if_exists='replace')
|
105 | 105 | df[['float', 'datetime_string']].to_sql('test_type', con, if_exists='replace')
|
106 | 106 | """
|
107 | 107 |
|
108 | 108 | sql_float_read_query_sqlalchemy = \
|
109 |
| - Benchmark("read_sql_query('SELECT float FROM test_type', engine)", |
110 |
| - setup, start_date=sdate) |
| 109 | + Benchmark("read_sql_query('SELECT float FROM test_type', engine)", |
| 110 | + setup, start_date=sdate) |
111 | 111 |
|
112 | 112 | sql_float_read_table_sqlalchemy = \
|
113 |
| - Benchmark("read_sql_table('test_type', engine, columns=['float'])", |
114 |
| - setup, start_date=sdate) |
| 113 | + Benchmark("read_sql_table('test_type', engine, columns=['float'])", |
| 114 | + setup, start_date=sdate) |
115 | 115 |
|
116 | 116 | sql_float_read_query_fallback = \
|
117 |
| - Benchmark("read_sql_query('SELECT float FROM test_type', con)", |
118 |
| - setup, start_date=sdate) |
| 117 | + Benchmark("read_sql_query('SELECT float FROM test_type', con)", |
| 118 | + setup, start_date=sdate) |
119 | 119 |
|
120 | 120 | sql_datetime_read_as_native_sqlalchemy = \
|
121 |
| - Benchmark("read_sql_table('test_type', engine, columns=['datetime'])", |
122 |
| - setup, start_date=sdate) |
| 121 | + Benchmark("read_sql_table('test_type', engine, columns=['datetime'])", |
| 122 | + setup, start_date=sdate) |
123 | 123 |
|
124 | 124 | sql_datetime_read_and_parse_sqlalchemy = \
|
125 |
| - Benchmark("read_sql_table('test_type', engine, columns=['datetime_string'], parse_dates=['datetime_string'])", |
126 |
| - setup, start_date=sdate) |
| 125 | + Benchmark("read_sql_table('test_type', engine, columns=['datetime_string'], parse_dates=['datetime_string'])", |
| 126 | + setup, start_date=sdate) |
0 commit comments