{"id":24740,"library":"tsfeatures","title":"tsfeatures","description":"Calculates various features from time series data, including autocorrelation, entropy, seasonality, stationarity, and trend-based metrics. Designed for time series classification and preprocessing. Current stable version is 0.4.5. Release cadence is irregular based on fixes and feature additions.","status":"active","version":"0.4.5","language":"python","source_language":"en","source_url":"https://github.com/Nixtla/tsfeatures","tags":["time-series","feature-engineering","feature-extraction","entropy","seasonality"],"install":[{"cmd":"pip install tsfeatures","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Data manipulation required for input/output.","package":"pandas","optional":false},{"reason":"Numerical operations used internally.","package":"numpy","optional":false},{"reason":"Used for ARIMA coefficients, unit root tests, etc.","package":"statsmodels","optional":false},{"reason":"Provides entropy features (sample entropy, etc.).","package":"antropy","optional":true}],"imports":[{"note":"Main class for computing features.","symbol":"Tsfeatures","correct":"from tsfeatures import Tsfeatures"},{"note":"The module does not expose a top-level function; must use the Tsfeatures class.","wrong":"import tsfeatures; tsfeatures.calculate_features(df)","symbol":"calculate_features","correct":"from tsfeatures import Tsfeatures; tf = Tsfeatures(); result = tf.calculate_features(df)"}],"quickstart":{"code":"import pandas as pd\nfrom tsfeatures import Tsfeatures\n\n# Sample time series data: one column with datetime index\ndates = pd.date_range('2020-01-01', periods=50, freq='D')\ndf = pd.DataFrame({'value': [i + (i%10)*0.5 for i in range(50)]}, index=dates)\n\ntf = Tsfeatures()\nfeatures = tf.calculate_features(df)\nprint(features)","lang":"python","description":"Compute default set of time series features on a single time series column."},"warnings":[{"fix":"Upgrade to >=0.1.0 and use the Tsfeatures class.","message":"Changed from function-based to class-based API in v0.1.0. Old code using `tsfeatures.calculate_features(df)` no longer works. Use `Tsfeatures().calculate_features(df)` instead.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Ensure index is a pandas DatetimeIndex with a recognizable frequency (e.g., 'D', 'H'). If not needed, use `Tsfeatures(freq=1)` to treat as non-seasonal.","message":"Input DataFrame must have a DatetimeIndex; otherwise features relying on frequency detection (like seasonal features) may fail or produce NaNs.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Install antropy: `pip install antropy` to get entropy-based features.","message":"Some features require the `antropy` library; if not installed, those features are silently skipped. No error raised.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Pass frequency to Tsfeatures constructor: `tf = Tsfeatures(freq=24)`.","message":"The `freq` parameter in `calculate_features` is deprecated as of v0.4.0. Use `Tsfeatures(freq=...)` constructor instead.","severity":"deprecated","affected_versions":"0.4.0 and later"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to: `from tsfeatures import Tsfeatures; tf = Tsfeatures(); features = tf.calculate_features(df)`","cause":"Using outdated function-based API; current library requires class instantiation.","error":"AttributeError: module 'tsfeatures' has no attribute 'calculate_features'"},{"fix":"Instantiate Tsfeatures with freq: `tf = Tsfeatures(freq=7)` then call `tf.calculate_features(df)` without freq argument.","cause":"Passing `freq` directly to `calculate_features` method in newer versions.","error":"ValueError: The 'freq' argument is not None. Please use freq via the Tsfeatures class."},{"fix":"Install missing dependency: `pip install antropy`. Alternatively, avoid entropy features by setting `features=['all']` but this may still call entropy functions.","cause":"Missing optional dependency (antropy) leads to internal function returning None when called.","error":"TypeError: 'NoneType' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}