1

My issue is as follows.

I've gathered some contact data from SurveyMonkey using the SM API, and I've converted that data into a txt file. When opening the txt file, I see the full data from the survey that I'm trying to convert into csv, however when I use the following code:

df = pd.read_csv("my_file.txt",sep =",", encoding = "iso-8859-10")

df.to_csv('my_file.csv')

It creates a csv file with only two lines of values (and cuts off in the middle of the second line). Similarly if I try to organize the data within a pandas dataframe, it only registers the first two lines, meaning most of my txt file is not being read registered.

As I've never run into this problem before and I've been able to convert into CSV without issues, I'm wondering if anyone here has ideas as to what might be causing this issue to occur and how I could go about solving it?

All help is much appreciated.

Edit:

I was able to get the data to display properly in csv, when I converted it directly into csv from json instead of converting it to a txt file first. I was not however able to figure out what when wrong in the conversion from txt to csv, as I tried multiple different encodings but came to the same result.

Ak17
  • 13
  • 4
  • It might help troubleshoot if you could provide more of the contents of the csv file here. Preliminary questions: are you sure the data is really in `iso-8859-10`? You might want to examine the contents of your file with a hex dumper (e.g., `od`, `xxd`), maybe you'd be able to see some problem characters in the input. – joanis Jun 09 '21 at 17:27

0 Answers0