Closed
Description
The last example in the "Enhancing performance" docs on cython (http://pandas.pydata.org/pandas-docs/dev/enhancingperf.html#more-advanced-techniques) is failing on Windows.
When I run the example I get a ValueError: Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long'
error:
In [18]: %timeit apply_integrate_f_wrap(df['a'].values, df['b'].values, df['N'].values)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-18-1222be30cf93> in <module>()
----> 1 get_ipython().magic(u"timeit apply_integrate_f_wrap(df['a'].values, df['b'].values, df['N'].values)")
c:\users\vdbosscj\scipy\ipython\IPython\core\interactiveshell.pyc in magic(self, arg_s)
2184 magic_name, _, magic_arg_s = arg_s.partition(' ')
2185 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2186 return self.run_line_magic(magic_name, magic_arg_s)
2187
2188 #-------------------------------------------------------------------------
c:\users\vdbosscj\scipy\ipython\IPython\core\interactiveshell.pyc in run_line_magic(self, magic_name, line)
2105 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2106 with self.builtin_trap:
-> 2107 result = fn(*args,**kwargs)
2108 return result
2109
c:\users\vdbosscj\scipy\ipython\IPython\core\magics\execution.pyc in timeit(self, line, cell)
c:\users\vdbosscj\scipy\ipython\IPython\core\magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
c:\users\vdbosscj\scipy\ipython\IPython\core\magics\execution.pyc in timeit(self, line, cell)
1011 number = 1
1012 for _ in range(1, 10):
-> 1013 if timer.timeit(number) >= 0.2:
1014 break
1015 number *= 10
C:\Anaconda\envs\devel\lib\timeit.pyc in timeit(self, number)
193 gc.disable()
194 try:
--> 195 timing = self.inner(it, self.timer)
196 finally:
197 if gcold:
<magic-timeit> in inner(_it, _timer)
C:\Users\vdbosscj\.ipython\cython\_cython_magic_fa1038e4eeefba896480cf749d6fc60d.pyd in _cython_magic_fa1038e4eeefba896480cf749d6fc60d.apply_integrate_f_wrap (C:\Users\vdbosscj\.ipython\cython\_cython_magic_fa1038e4eeefba896480cf749d6fc60d.c:1762)()
ValueError: Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long'