import numpy as np
from deephaven.TableTools import newTable, doubleCol
def my_function(A):
total = 0
for i in range(0, len(A)):
total = total + A[i]
return total
dh_table = newTable(doubleCol("X", np.random.randn(10,1))).updateView("A= X_.subVector(i-2,i+1)","rolling_mean = avg(A)", "rolling_median =median(A)", "rolling_sum = sum(A)", "FuncX=my_function(A)").dropColumns("A")
I have a table that I want to test if there is enough data before doing calculations.
def verify_series(series: Series, min_length: int = None) -> Series:
"""If a Pandas Series and it meets the min_length of the indicator return it."""
has_length = min_length is not None and isinstance(min_length, int)
if series is not None and isinstance(series, Series):
return None if has_length and series.size < min_length else series
I have the data as a column as DateTime values, I want to make sure there are like 10 of those times before doing the calc.