To create Python Pandas DataFrame from txt file with a specific pattern, we can use the read_csv
method.
For instance, we write
df = pd.read_csv('filename.txt', sep=";", names=['Region Name'])
to call read_csv
with the path of the txt file to read from.
sep
is set to the separator for the row items.
And names
is the column name of the columns to create.