10/07/2022

python, pandas, to create empty data frame with same header from other df.

 

refer to code.

..

import pandas as pd
data_df = pd.read_csv('train_data.tsv', delimiter='\t')
col = list(data_df.columns)

#make empty pandas with same header
empty_df = pd.DataFrame(columns=col)
print(empty_df)

..


Thank you.

www.marearts.com

No comments:

Post a Comment