pandas read text 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: pandas open text file

df = pd.read_csv('output_list.txt', sep=" ", header=None, names=["a", "b", "c"])

data = pd.read_csv('output_list.txt', sep=" ", header=None)
data.columns = ["a", "b", "c", "etc."]

Example 4: load pandas from text

df = pd.read_csv('output_list.txt', sep=" ", header=None)
# or
df = pd.read_fwf('output_list.txt')

Example 5: pandas read from txt separtion

data = pd.read_csv('fileName.txt', sep=" ", header=None)

Tags:

Go Example