Let\'s take a simple function that takes a str and returns a dataframe:
import pandas as pd def csv_to_df(path): return pd.read_csv(path, skiprows=1, sep
Now there is a pip package that can help with this. https://github.com/CedricFR/dataenforce
You can install it with pip install dataenforce and use very pythonic type hints like:
pip install dataenforce
def preprocess(dataset: Dataset["id", "name", "location"]) -> Dataset["location", "count"]: pass