Create df with specified columns
August 18, 2022
df.reindex(columns=..., fill_value=...)
For example:
data = [{"port_id": "abc", "sec_id": 111, "metric_1": 1, "metric_2": 2}]
df = pd.DataFrame(data)
cols = ["port_id", "sec_id", "metric_2", "metric_1", "random_metric"]
df.reindex(columns=cols)