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.
Time series
Section titled “Time series”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 pdimport 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). |
curl -sO https://raw.githubusercontent.com/jbrownlee/Datasets/master/daily-min-temperatures.csvyhatlabs check daily-min-temperatures.csv --h 28 --time-col Date --target TempDataCheck(timeseries: 1 series, 1 note)severity code where detail suggestion note missing_timestamps series_0 2 missing timestamps (0% of the grid). They are sent as gaps; yh.fill_gaps() fills them from the history before each gap.Parameters: yhatlabs.check
Tables
Section titled “Tables”With target= and no time column, the data is checked as a table to predict target from:
import pandas as pdimport 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. |
curl -s -o titanic.csv https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csvyhatlabs check titanic.csv --target SurvivedDataCheck(tabular: 12 columns, 2 warnings, 2 notes)severity code where detail suggestion warning id_like PassengerId 891 distinct values in 891 rows: looks like an id. Drop identifier columns; they don't generalise. warning id_like Name 891 distinct values in 891 rows: looks like an id. Drop identifier columns; they don't generalise. note high_cardinality Ticket 681 distinct text values. Free text is not modelled; group rare values or drop it. note mostly_missing Cabin 77% missing. Fine to keep; missing values are handled.Parameters: yhatlabs.check
What you get
Section titled “What you get”.issues: one row per finding, withseverity(error,warningornote),code,where,detailandsuggestion..profile: one row per series (start, end, points, frequency, missing values) or per column (type, missing share, distinct values)..ok:Falsewhen something would make the call fail..repaired(), for series: the data after the clean-upforecastapplies (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.
Everything it looks for
Section titled “Everything it looks for”| 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 |

