def main(): # sample data definitions dt = datetime.datetime(2017, 1, 1, 0, 0, 0) inf = float("inf") nan = float("nan") data_matrix = [ [1, 1.1, "aa", 1, 1, True, inf, nan, dt], [2, 2.2, "bbb", 2.2, 2.2, False, "inf", "nan", dt], [3, 3.33, "cccc", -3, "ccc", "true", inf, "NAN", "2017-01-01T01:23:45+0900"], ] # extract property for each column from a matrix dp_extractor = DataPropertyExtractor() dp_extractor.header_list = [ "int", "float", "str", "num", "mix", "bool", "inf", "nan", "time"] dp_extractor.data_matrix = data_matrix col_dp_list = dp_extractor.to_col_dataproperty_list() print("---------- typename ----------") print([Typecode.get_typename(dp.typecode) for dp in col_dp_list]) display_col_dp(col_dp_list, "align") display_col_dp(col_dp_list, "ascii_char_width") display_col_dp(col_dp_list, "decimal_places") return 0
def main(): # sample data definitions dt = datetime.datetime(2017, 1, 1, 0, 0, 0) inf = float("inf") nan = float("nan") # extract data property for each element from a matrix dp_extractor = DataPropertyExtractor() dp_extractor.data_matrix = [ [1, 1.1, "aa", 1, 1, True, inf, nan, dt], [2, 2.2, "bbb", 2.2, 2.2, False, "inf", "nan", dt], [3, 3.33, "cccc", -3, "ccc", "true", inf, "NAN", "2017-01-01T01:23:45+0900"], ] dp_matrix = dp_extractor.to_dataproperty_matrix() print("---------- typename ----------") for dp_list in dp_matrix: print([Typecode.get_typename(dp.typecode) for dp in dp_list]) display_dp_matrix_attr(dp_matrix, "data") display_dp_matrix_attr(dp_matrix, "align") display_dp_matrix_attr(dp_matrix, "length") display_dp_matrix_attr(dp_matrix, "integer_digits") display_dp_matrix_attr(dp_matrix, "decimal_places") return 0