Skip to content

Commit 92011b7

Browse files
cgdeboertwiecki
authored andcommitted
unrequire bottleneck, adjust README, etc. (#115)
1 parent a9e6a71 commit 92011b7

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![Build Status](https://travis-ci.org/quantopian/empyrical.svg?branch=master)](https://travis-ci.org/quantopian/empyrical)
2+
3+
![PyPI](https://img.shields.io/pypi/v/empyrical?color=%234ec726&style=flat-square)
4+
15
# empyrical
26

37
Common financial risk metrics.
@@ -102,5 +106,5 @@ Please contribute using [Github Flow](https://guides.github.com/introduction/flo
102106
- "parameterized>=0.6.1"
103107

104108
```
105-
python -m unittest
109+
./runtests.py
106110
```

empyrical/stats.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def unary_vectorized_roll(arr, window, out=None, **kwargs):
5252

5353
if len(arr):
5454
out = function(
55-
rolling_window(arr, min(len(arr), window)).T,
55+
rolling_window(_flatten(arr), min(len(arr), window)).T,
5656
out=out,
5757
**kwargs
5858
)
@@ -100,8 +100,8 @@ def binary_vectorized_roll(lhs, rhs, window, out=None, **kwargs):
100100

101101
if window >= 1 and len(lhs) and len(rhs):
102102
out = function(
103-
rolling_window(lhs, min(len(lhs), window)).T,
104-
rolling_window(rhs, min(len(rhs), window)).T,
103+
rolling_window(_flatten(lhs), min(len(lhs), window)).T,
104+
rolling_window(_flatten(rhs), min(len(rhs), window)).T,
105105
out=out,
106106
**kwargs
107107
)
@@ -125,6 +125,10 @@ def binary_vectorized_roll(lhs, rhs, window, out=None, **kwargs):
125125
return binary_vectorized_roll
126126

127127

128+
def _flatten(arr):
129+
return arr if not isinstance(arr, pd.Series) else arr.values
130+
131+
128132
def _adjust_returns(returns, adjustment_factor):
129133
"""
130134
Returns the returns series adjusted by adjustment_factor. Optimizes for the

runtests.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import unittest
4+
import warnings
5+
6+
7+
if __name__ == '__main__':
8+
with warnings.catch_warnings():
9+
warnings.simplefilter('ignore', category=RuntimeWarning)
10+
loader = unittest.TestLoader()
11+
tests = loader.discover('.')
12+
testRunner = unittest.runner.TextTestRunner()
13+
testRunner.run(tests)

setup.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
from setuptools import setup
17-
import os
1817
import versioneer
1918

2019

@@ -61,16 +60,9 @@
6160
'numpy>=1.9.2',
6261
'pandas>=0.16.1',
6362
'scipy>=0.15.1',
64-
"pandas-datareader>=0.2",
65-
'bottleneck>=1.0.0'
63+
"pandas-datareader>=0.2"
6664
]
6765

68-
# ReadTheDocs does not handle bottleneck properly, remove if running on RTD
69-
on_rtd = os.environ.get('READTHEDOCS') == 'True'
70-
if on_rtd:
71-
botttleneck_string = [x for x in requirements if 'bottleneck' in x]
72-
requirements.remove(botttleneck_string[0])
73-
7466
extras_requirements = {
7567
"dev": [
7668
"nose==1.3.7",

0 commit comments

Comments
 (0)