I have the following code where I am trying to download a csv
fs = gcsfs.GCSFileSystem(project='<project ID>', token='<path to service account json>')
with fs.open('gs://some_path_to_csv') as f:
stability_data = pd.read_csv(f, delimiter=',', encoding='UTF-16 LE')
return stability_data
This code works perfectly on Mac, but doesn't work on Windows. On Windows I am getting the following data:
ÿþD Unnamed: 1 Unnamed: 2 Unnamed: 3
0 NaN NaN NaN NaN
1 NaN NaN NaN NaN
2 NaN NaN NaN NaN
ÿþD Unnamed: 1 Unnamed: 2 Unnamed: 3
0 NaN NaN NaN NaN
1 NaN NaN NaN NaN
2 NaN NaN NaN NaN
Looks like an issue with encoding or conversion from bytes to string. But I still haven't figured out what the issue is. Please help. Thanks!
UPDATE: The issue seems to be with Python 3.x and not Windows/Mac. If I use Python 2.7 the code runs, but if I use Python 3.7 it fails with the below error:
UnicodeDecodeError: 'utf-16-le' codec can't decode byte 0x74 in position 0: truncated data