BUG #388 append=None instead of False BUG vhf inf to nan fix

This commit is contained in:
Kevin Johnson
2022-03-25 08:39:55 -07:00
parent 05349f82af
commit 12df62682b
12 changed files with 1972 additions and 1973 deletions
+1 -1
View File
@@ -198,7 +198,7 @@ $ pip install pandas_ta[full]
Latest Version
--------------
Best choice! Version: *0.3.58b*
Best choice! Version: *0.3.59b*
* Includes all fixes and updates between **pypi** and what is covered in this README.
```sh
$ pip install -U git+https://github.com/twopirllc/pandas-ta
File diff suppressed because one or more lines are too long
+495 -491
View File
File diff suppressed because it is too large Load Diff
+257 -257
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+84 -84
View File
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -364,9 +364,10 @@ class AnalysisIndicators(object):
# Add prefix/suffix and append to the dataframe
self._add_prefix_suffix(result=result, **kwargs)
if kwargs["append"]:
if "append" in kwargs and kwargs["append"]:
# Default: Appends result to DataFrame
self._append(result=result, **kwargs)
else:
if "append" in kwargs and kwargs["append"] is None:
# Issue 388 - No appending, just print to stdout
# No DatetimeIndex could break execution.
print(result)
+3 -6
View File
@@ -60,12 +60,9 @@ def vwap(
anchor = "D"
typical_price = hlc3(high=high, low=low, close=close)
if not v_datetime_ordered(volume):
_s = "[!] VWAP volume series is not datetime ordered."
print(f"{_s} Results may not be as expected.")
if not v_datetime_ordered(typical_price):
_s = "[!] VWAP price series is not datetime ordered."
print(f"{_s} Results may not be as expected.")
if not v_datetime_ordered(volume) or not v_datetime_ordered(typical_price):
print("[!] VWAP requires a datetime ordered index.")
return
# Calculate
_props = f"VWAP_{anchor}"
+3 -1
View File
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from numpy import fabs
from numpy import inf, fabs, nan
from pandas import Series
from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import non_zero_range, v_drift, v_offset
@@ -44,6 +44,8 @@ def vhf(
lcp = close.rolling(length).min()
diff = fabs(close.diff(drift))
vhf = fabs(non_zero_range(hcp, lcp)) / diff.rolling(length).sum()
vhf.replace([inf, -inf], nan, inplace=True)
# np_vhf = where(np_vhf == inf, nan, np_vhf)
# Offset
if offset != 0:
-3
View File
@@ -198,9 +198,6 @@ def speed_test(df: DataFrame,
if len(_indicators) == 0: return None
_iname = "Indicator"
if verbose:
print()
+1 -1
View File
@@ -20,7 +20,7 @@ setup(
"pandas_ta.volatility",
"pandas_ta.volume"
],
version=".".join(("0", "3", "58b")),
version=".".join(("0", "3", "59b")),
description=long_description,
long_description=long_description,
author="Kevin Johnson",
+1 -1
View File
@@ -112,7 +112,7 @@ class TestStudyMethods(TestCase):
self.category = "Candles"
self.data.ta.study(pandas_ta.AllStudy, verbose=verbose, timed=timed_test)
@skipUnless(verbose, "verbose mode only")
# @skipUnless(verbose, "verbose mode only")
def test_all_without_append(self):
"""Study: All sans append"""
self.category = "All: Sans append"