Item = namedtuple('Item', 'state area')
items = []
with open('unis.txt') as f:
    for line in f:
        l = line.rstrip('\n')
if l.endswith('[edit]'):
    state = l.rstrip('[edit]')
else:
    i = l.index(' (')
area = l[:i]
items.append(Item(state, area))
df = pd.DataFrame.from_records(items, columns=['State', 'Area'])
print(df)
Create Pandas DataFrame from txt file with specific pattern