create_tmdl
create_tmdl(dashboard_path, dataset_name, dataset_id, dataset)
An internally called function that creates a TMDL file from a pandas dataframe
:param str dashboard_path: The path where the dashboard files are stored. (This is the top level directory containing the .pbip file and Report and SemanticModel folders). :param str dataset_name: The name of the dataset. This should be the basename of the original file without the extension. For example if you loaded “%userprofile%/documents/datasets/birds.csv”, the dataset name would be “birds”. :param str dataset_id: The dataset’s UUID, this will be generated by the outer level function that calls create_tmdl(). :param DataFrame dataset: This is a pandas dataframe of the csv’s content. The pd.read_csv() function is called by the outer level function that calls create_tmdl().
:returns: col_attributes: A dictionary containing the name and type of all the columns in the dataset. This is needed to get the M code in the outer level function to work.
This function loops through all the dataframe’s columns, checks the column’s type (text, number, date), and generates the appropriate TMDL column definition for that type. Dates will only be recocognized as dates if they are in the format (YYYY-MM-DD) i.e. (1999-12-31). If your date is in another format please change in python before calling the add_csv functions.