txt file to pandas dataframe code example
Example 1: read txt file pandas
df = pd.read_csv('output_list.txt', sep=" ", header=None, names=["a", "b", "c"])
Example 2: read txt in pandas
data = pd.read_csv('output_list.txt', sep=" ", header=None)
data.columns = ["a", "b", "c", "etc."]
Example 3: dataframe to txt
df.to_csv(r'c:\data\pandas.txt', header=None, index=None, sep=' ', mode='a')