Fixes #229 by converting out ProcessPoolExecutor to a ThreadPoolExecutor. ProcessPoolExecutor is a little more picky about where it runs.
As well I was getting a TypeError in statcast_pitcher_spin.py when running the tests (python 3.7.9):
pybaseball/statcast_pitcher_spin.py:135: in find_phi
df['phi'] = df['phi'].round(0).astype('int64')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = 0 190.754943
1 300.794706
2 243.13629
3 288.17292
4 291.559998
...
4215...5478
4216 448.531754
4217 436.495487
4218 440.636358
4219 434.056495
Name: phi, Length: 4220, dtype: object
decimals = 0, args = (), kwargs = {}
def round(self, decimals=0, *args, **kwargs) -> Series:
"""
Round each value in a Series to the given number of decimals.
Parameters
----------
decimals : int, default 0
Number of decimal places to round to. If decimals is negative,
it specifies the number of positions to the left of the decimal point.
*args, **kwargs
Additional arguments and keywords have no effect but might be
accepted for compatibility with NumPy.
Returns
-------
Series
Rounded values of the Series.
See Also
--------
numpy.around : Round values of an np.array.
DataFrame.round : Round values of a DataFrame.
Examples
--------
>>> s = pd.Series([0.1, 1.3, 2.7])
>>> s.round()
0 0.0
1 1.0
2 3.0
dtype: float64
"""
nv.validate_round(args, kwargs)
> result = self._values.round(decimals)
E TypeError: loop of ufunc does not support argument 0 of type float which has no callable rint method
So I followed the recommendation to make sure the column is cast to a float first before rounding.
Fixes #229 by converting out ProcessPoolExecutor to a ThreadPoolExecutor. ProcessPoolExecutor is a little more picky about where it runs.
As well I was getting a TypeError in
statcast_pitcher_spin.py
when running the tests (python 3.7.9):So I followed the recommendation to make sure the column is cast to a float first before rounding.