0

In order to load tsv/csv files from an API I used:

url = "https://www.dwds.de/r/?q=Angst&limit=15&view=tsv"
pd.read_csv(url ,sep='\t', encoding = "utf-8")

This works perfectly fine with urls which are suitable for ascii and returns an expected csv file. But if the url contains Umlaut (such as ä,ü,ö) it throws an error.

For instance:

url = "https://www.dwds.de/r/?q=Angstgefühl&limit=15&view=tsv"
pd.read_csv(url ,sep='\t', encoding = "utf-8")

>>> UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 18: ordinal not in range(128)

Here I used an url with Angstgefühl inside it, which contains an Ü. I think read_csv can not handle that. Is there an alternative or a way to use read_csv in that case?

Oweys
  • 47
  • 6

0 Answers0