database#
- class utils.database.NMDatabase(name: str, out_dir: str | PathLike, csv_path: str | PathLike | None = None)[source]#
Class to create a database and insert data into it. :param out_dir: The directory to save the database. :type out_dir: _PathLike :param csv_path: The path to save the csv file. If not provided, it will be saved in the same folder as the database. :type csv_path: str, optional
- create_table(feature_dict: dict)[source]#
Create a table in the database. :param feature_dict: The dictionary with the feature names and values. :type feature_dict: dict
- fetch_all()[source]#
” Fetch all the data from the database. :returns: The data in a pandas DataFrame. :rtype: pd.DataFrame
- head(n: int = 5)[source]#
” Returns the first N rows of the database. :param n: The number of rows to fetch, by default 1 :type n: int, optional :param ——-: :param pd.DataFrame: The data in a pandas DataFrame.