Exemple #1
0
def main():
    """Test the type of each value of each row."""
    # dictionaries {column_index, column_name} & {column_name, column_index}
    selected_columns = ["GEOID", "CBSA09", "CBSA_T", "POP00", "POP10", "PPCHG"]
    cols, cols_inds = transformation.create_column_dicts(path_to_raw)
    transformation.select_columns(path_to_raw, path_to_selected_columns,
                                  selected_columns, cols_inds)

    cols, cols_inds = transformation.create_column_dicts(
        path_to_selected_columns)
    (
        cbsa_title,
        tract_count,
        pop00_count,
        pop10_count,
        ppchg_avg,
        error_rows,
    ) = transformation.groupby_cbsa(path_to_selected_columns, path_to_log,
                                    selected_columns, cols_inds)

    transformation.write_report(
        path_to_report,
        cbsa_title,
        tract_count,
        pop00_count,
        pop10_count,
        ppchg_avg,
    )
def main():
    """Test the type of each value of each row."""
    # dictionaries {column_index, column_name} & {column_name, column_index}
    col_types = [
        int,
        int,
        int,
        int,
        float,
        float,
        int,
        int,
        str,
        any,
        int,
        str,
        int,
        int,
        int,
        int,
        int,
        float,
        int,
        float,
    ]
    cols, cols_inds = transformation.create_column_dicts(path_to_raw)
    validation.test_types(path_to_raw, path_to_log, cols_inds, col_types)
    "path_to_output_file",
    help="The output path should be './output/report.csv'.",
    type=str,
)
args = parser.parse_args()

# file paths
path_to_raw = args.path_to_input_file
path_to_report = args.path_to_output_file
path_to_selected_columns = "./src/transformed_data/selected_columns.csv"
path_to_cleaned_types = "./src/transformed_data/cleaned_types.csv"
path_to_log = "./src/logs/log.csv"

# Begin Pipeline
# dictionaries {column_index, column_name} & {column_name, column_index}
cols, cols_inds = transformation.create_column_dicts(path_to_raw)

# Validation
validation.test_row_length(path_to_raw, path_to_log)
# col_types = ["int", "int", "int", "int", "float", "float", "int", "int", "str", "any", "int", "str", "int", "int", "int", "int", "int", "float", "int", "float"]
col_types = [
    int,
    int,
    int,
    int,
    float,
    float,
    int,
    int,
    str,
    any,
Exemple #4
0
def main():
    """Test that the GEOID is the concatenation of its components."""
    # dictionaries {column_index, column_name} & {column_name, column_index}
    cols, cols_inds = transformation.create_column_dicts(path_to_raw)
    validation.test_geoid_concat(path_to_raw, path_to_log, cols_inds)
def main():
    """Test that the GEOID is the concatenation of its components."""
    # dictionaries {column_index, column_name} & {column_name, column_index}
    cols, cols_inds = transformation.create_column_dicts(path_to_raw)
    select_cols = ["GEOID", "CBSA09", "CBSA_T", "POP00", "POP10", "PPCHG"]
    validation.test_row_length(path_to_raw, path_to_log)