Skip to content
Log inGet startedHugging FaceGitHub

Tools

Data checks

check looks at your data on your own machine, before anything is sent, and says what it found and how to fix it. It needs no key and makes no request.

With a time column, the data is checked as time series. Passing h= also checks there is enough history for that horizon:

import pandas as pd
import yhatlabs
url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/"
temps = pd.read_csv(url + "daily-min-temperatures.csv")
report = yhatlabs.check(temps, h=28, time_col="Date", target="Temp")
print(report)
print(report.issues[["severity", "code", "detail"]].to_string(index=False))
Output
DataCheck(timeseries: 1 series, 1 note)
severity code detail
note missing_timestamps 2 missing timestamps (0% of the grid).

Parameters: yhatlabs.check

With target= and no time column, the data is checked as a table to predict target from:

import pandas as pd
import yhatlabs
titanic = pd.read_csv("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
report = yhatlabs.check(titanic, target="Survived")
print(report)
print(report.issues[["severity", "code", "where", "detail"]].to_string(index=False))
Output
DataCheck(tabular: 12 columns, 2 warnings, 2 notes)
severity code where detail
warning id_like PassengerId 891 distinct values in 891 rows: looks like an id.
warning id_like Name 891 distinct values in 891 rows: looks like an id.
note high_cardinality Ticket 681 distinct text values.
note mostly_missing Cabin 77% missing.

Parameters: yhatlabs.check

  • .issues: one row per finding, with severity (error, warning or note), code, where, detail and suggestion.
  • .profile: one row per series (start, end, points, frequency, missing values) or per column (type, missing share, distinct values).
  • .ok: False when something would make the call fail.
  • .repaired(), for series: the data after the clean-up forecast applies (sorted, duplicates dropped, missing timestamps added), so you can see it before sending.

From the terminal, yhatlabs check exits with code 2 when it finds an error, so it can stop a pipeline.

Time series Tables
duplicate rows, or timestamps repeated within a series a target with a single value
mixed or unknown frequencies columns that copy, or nearly copy, the target
missing timestamps and values id-like columns
too little history for the horizon imbalanced classes
extreme values, rare negatives integer targets that could be classes or a count
series that end before the others constant, mostly empty or free-text columns