From f95dc9311130b83151fc6bfdc98219ab73f029a3 Mon Sep 17 00:00:00 2001 From: Reza Allahyarzadeh Date: Sun, 3 May 2020 16:28:47 +0300 Subject: [PATCH] update sma.py adding fillna and fill_method --- pandas_ta/overlap/sma.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandas_ta/overlap/sma.py b/pandas_ta/overlap/sma.py index 2f137db..ea49511 100644 --- a/pandas_ta/overlap/sma.py +++ b/pandas_ta/overlap/sma.py @@ -15,6 +15,12 @@ def sma(close, length=None, offset=None, **kwargs): # Offset if offset != 0: sma = sma.shift(offset) + + # Handle fills + if 'fillna' in kwargs: + sma.fillna(kwargs['fillna'], inplace=True) + if 'fill_method' in kwargs: + sma.fillna(method=kwargs['fill_method'], inplace=True) # Name & Category sma.name = f"SMA_{length}" @@ -51,4 +57,4 @@ Kwargs: Returns: pd.Series: New feature generated. -""" \ No newline at end of file +"""