how to create a new dataframe with header names code example
Example 1: create dataframe with column names pandas
In [4]: import pandas as pd
In [5]: df = pd.DataFrame(columns=['A','B','C','D','E','F','G'])
In [6]: df
Out[6]:
Empty DataFrame
Columns: [A, B, C, D, E, F, G]
Index: []
Example 2: how to create new header of a dataframe in python
pythonCopy# python 3.x
import pandas as pd
import numpy as np
df = pd.DataFrame(data=np.random.randint(0, 10, (6,4)))
df.columns=["a", "b", "c", "d"]
print(df)