I am trying to extract text from a bunch of text files and place it into a dataframe. I keep getting a "'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte" error and cannot figure out how to fix it. Does anyone have any advice? My code is below. Thanks!
#EXTRACT TEXT
def read(file_path):
with codecs.open(file_path, 'r') as f:
return f.read()
#CREATE VARIABLE BY APPLYING THE FUNCTION
pd_00['text'] = pd_00['file_path'].apply(read)