def align_from_data(self, data: TblData) -> Self:
        """Updates align attribute in entries based on data types."""

        # TODO: validate that data columns and ColInfo list correspond
        if len(get_column_names(data)) != len(self._d):
            raise ValueError("Number of data columns must match length of Boxhead")

        if any(
            col_info.var != col_name for col_info, col_name in zip(self._d, get_column_names(data))
        ):
            raise ValueError("Column names must match between data and Boxhead")

        # Obtain a list of column classes for each of the column names by iterating
        # through each of the columns and obtaining the type of the column from
        # a Pandas DataFrame or a Polars DataFrame
        col_classes = []
        for col in get_column_names(data):
            dtype = _get_column_dtype(data, col)

            if dtype == "object":
                # Check whether all values in 'object' columns are strings that
                # for all intents and purpose are 'number-like'

                col_vals = data[col].to_list()

                # Detect whether all non-NA values in the column are 'number-like'
                # through use of a regular expression
                number_like_matches = []

                for val in col_vals:
                    if isinstance(val, str):
                        number_like_matches.append(re.match("^[0-9 -/:\\.]*$", val))

                # If all values in the column are 'number-like', then set the
                # dtype to 'character-numeric'
                if all(number_like_matches):
                    dtype = "character-numeric"

            col_classes.append(dtype)

        # Get a list of `align` values by translating the column classes
        align: list[str] = []

        for col_class in col_classes:
            # Ensure that `col_class` is lowercase
            col_class = str(col_class).lower()

            # Translate the column classes to an alignment value of 'left', 'right', or 'center'
            if col_class == "character-numeric":
                align.append("right")
            elif col_class == "object":
                align.append("left")
            elif col_class == "utf8":
                align.append("left")
            elif col_class == "string":
                align.append("left")
            elif (
                _str_detect(col_class, "int")
                or _str_detect(col_class, "uint")
                or _str_detect(col_class, "float")
            ):
                align.append("right")
            elif _str_detect(col_class, "date"):
                align.append("right")
            elif _str_detect(col_class, "bool"):
                align.append("center")
            elif col_class == "factor":
                align.append("center")
            elif col_class == "list":
                align.append("center")
            else:
                align.append("center")

        # Set the alignment for each column in the boxhead
        new_cols: list[ColInfo] = []
        for col_info, alignment in zip(self._d, align):
            new_cols.append(replace(col_info, column_align=alignment))

        return self.__class__(new_cols)
Updates align attribute in entries based on data types.
great_tables/_gt_data.py