Open 2W-12 opened 3 years ago
Hi, I'm facing issue with
import pandas as pd import tulipy as ti df = pd.DataFrame({'datetime': {0: '2017-08-14 00:00:00', 1: '2017-08-21 00:00:00', 2: '2017-08-28 00:00:00', 3: '2017-09-04 00:00:00', 4: '2017-09-11 00:00:00', 5: '2017-09-18 00:00:00', 6: '2017-09-25 00:00:00', 7: '2017-10-02 00:00:00', 8: '2017-10-09 00:00:00', 9: '2017-10-16 00:00:00', 10: '2017-10-23 00:00:00', 11: '2017-10-30 00:00:00', 12: '2017-11-06 00:00:00', 13: '2017-11-13 00:00:00'}, 'open': {0: 4261.48, 1: 4069.13, 2: 4310.01, 3: 4505.0, 4: 4153.62, 5: 3690.0, 6: 3660.02, 7: 4400.0, 8: 4640.0, 9: 5710.0, 10: 5975.0, 11: 6133.01, 12: 7345.1, 13: 5839.94}, 'high': {0: 4485.39, 1: 4453.91, 2: 4939.19, 3: 4788.59, 4: 4394.59, 5: 4123.2, 6: 4406.52, 7: 4658.0, 8: 5922.3, 9: 6171.0, 10: 6189.88, 11: 7590.25, 12: 7770.02, 13: 8123.15}, 'low': {0: 3850.0, 1: 3400.0, 2: 4124.54, 3: 3603.0, 4: 2817.0, 5: 3505.55, 6: 3653.69, 7: 4110.0, 8: 4550.0, 9: 5037.95, 10: 5286.98, 11: 6030.0, 12: 5325.01, 13: 5699.99}, 'close': {0: 4086.29, 1: 4310.01, 2: 4509.08, 3: 4130.37, 4: 3699.99, 5: 3660.02, 6: 4378.48, 7: 4640.0, 8: 5709.99, 9: 5950.02, 10: 6169.98, 11: 7345.01, 12: 5811.03, 13: 8038.0}}) fast_sma = ti.sma(df.close.to_numpy(), period=3) slow_sma = ti.sma(df.close.to_numpy(), period=5) diff = fast_sma - slow_sma
and error is:
# >> ValueError: operands could not be broadcast together with shapes (12,) (10,)
as I understand it's because tulipy doesn't fill missing values with NaN and just returned sliced array but I can't find efficient way to add missing NaNs.
Any suggestions?
https://github.com/cirla/tulipy/issues/30#issuecomment-481948457
Hi, I'm facing issue with
and error is:
as I understand it's because tulipy doesn't fill missing values with NaN and just returned sliced array but I can't find efficient way to add missing NaNs.
Any suggestions?