I have a function that reads a text file and then parses it into a data frame.
Usually the input file will be something like this:
A B M 1 2 100
Just eat the exception and make an empty df:
def read_data(file): try: df = pd.read_csv(file, delim_whitespace=True) except pandas.io.common.EmptyDataError: df = pd.DataFrame() return df