Answers for "add header for dataframe python"

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
2

add header to table in pandas

# 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 July-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language