Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add a new row to the dataframe for column names python

# pandas package is required
import pandas as pd
 
# converting csv file to data frame
data_frame = pd.read_csv("test.txt", sep='	',
                         names=['Name', 'Age', 'Profession'])
 
 
# printing data frame
print("Data frame")
print(data_frame)
 
# printing row header
print("Row header")
print(list(data_frame.columns))
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #add #row #dataframe #column #names #python
ADD COMMENT
Topic
Name
2+2 =