You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# loading some time-series data
from io import BytesIO
from zipfile import ZipFile
from urllib.request import urlopen
from xpandas.data_container import XSeries, XDataFrame
import numpy as np
import pandas as pd
def read_data(file):
data = file.readlines()
rows = [row.decode('utf-8').strip().split(' ') for row in data]
X = pd.DataFrame(rows, dtype=np.float)
y = X.pop(0)
ts = XSeries([row for _, row in X.iterrows()])
X = XDataFrame({'ts1': ts, 'ts2': ts})
return X, y
url = 'http://www.timeseriesclassification.com/Downloads/GunPoint.zip'
url = urlopen(url)
zipfile = ZipFile(BytesIO(url.read()))
file = zipfile.open('GunPoint_TRAIN.txt')
X, y = read_data(file)
X.mean() # returns empty series rather than mean of series, the same for many other methods like .std(), .median(), etc)
X.apply(np.mean) # breaks
X['ts1'].mean() # breaks
X['ts1'].apply(np.mean) # works
X['ts1'].apply(np.percentile, args=(25,)) # breaks, does not passes on args
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: