I Need to Create Data Frame Using Multiple text files, all the text files are in same directory
Text File Format, each text file contains data showed in image
here I need to create DataFrame using these kind of multiple text files
I Need to Create Data Frame Using Multiple text files, all the text files are in same directory
Text File Format, each text file contains data showed in image
here I need to create DataFrame using these kind of multiple text files
If it is possible to remove the last line (Name: 45559, dtype: object) then you should be able to load txt file as a csv:
import pandas as pd
import os
txt_files_dir = '...'
files = os.listdir(txt_files_dir)
dfs_list = [pd.read_csv(file, sep='\s+') for file in files]
data_frame_result = pd.concat(dfs_list, axis=0, ignore_index=True)