Getting error csv_reader() got an unexpected keyword argument 'encoding'

def csv_reader(add):
    with open(outfilename, 'r',encoding='utf8') as f:
        reader = csv.reader(f, delimiter=';')
        headers = next(reader)
        data = np.array(list(reader)).astype(float)
        
    return data[:,2:] `Preformatted text`

I am using above function to read a csv file But when I ran this below snippet

MFCC = csv_reader(outfilename,encoding='utf8')

Getting this error
csv_reader() got an unexpected keyword argument ‘encoding’

Tried removing this encoding keyword too . but then its throwing:
UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x8f in position 33: character maps to

Actually this csv file is a feature extraction through opensmile toolkit. The csv file which is created after execution is like
Á† œ ÀÃ}rÁ`eÌ@×oGÁ˹ô@ÄîÁ©@ówÁ¯"ÀàV@GAuïó@ë’BÎÆÒ?i»¿‰< ?×z?‘E=¿ŽŽÌ¿Ä¦s¾´j@-8A@5w¾øºšÀæåÀe¾¼Í=ãƃ>ì
Can anyone guide one this plz.
Regards

This issue doesn’t seem to be PyTorch-specific and I would recommend to post it to a Python-related board (or StackOverflow) for faster help. :wink:

That being said, as you’ve already explained, csv_reader doesn’t accept an encoding argument so you would have to remove it.
For the encoding error, maybe this post is helpful.

1 Like

@ptrblck Thanks sir
I have removed that argument alraedy :frowning:
In fact tried all encoding formats.