Answers for "python pandas add header to dataframe"

6

how to add column headers in pandas

#suppose team is a df that has unnamed columns (0,1...)
team.columns =['Name', 'Code', 'Age', 'Weight']
Posted by: Guest on September-03-2020
-1

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)
Posted by: Guest on October-31-2020

Code answers related to "python pandas add header to dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language