Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas remove multi header from dataframe

df = pd.read_table('yourfile.csv', header=None, delim_whitespace=True, skiprows=1)
df.columns = ['0','POSITION_T','PROB','ID']
del df['0']

# filtering out the rows with `POSITION_T` value in corresponding column
df = df[df.POSITION_T.str.contains('POSITION_T') == False]

print(df)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #remove #multi #header #dataframe
ADD COMMENT
Topic
Name
2+5 =