Skip to content

Commit 30f40e3

Browse files
silau2005jreback
authored andcommitted
remove string ',' in quote price (#335)
* remove string ',' in quote price replace(',','') this will facilitate the conversion from string to float, and avoid exception * remove string ',' in quote price this string ',' removal is especially important for handling index price e.g. INDEXHANGSENG:HSI the original quote price is a string with ',' to show the thousand price point which will cause error when converting to float edited for PEP8 this is a re-summit as Im seeing some requests on this issue, wish could pass the test
1 parent 2aac3ec commit 30f40e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas_datareader/google/quotes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _read_lines(self, out):
2828
buffer = out.read()
2929
m = re.search('// ', buffer)
3030
result = json.loads(buffer[m.start() + len('// '):])
31-
return pd.DataFrame([[float(x['cp']), float(x['l']),
31+
return pd.DataFrame([[float(x['cp']), float(x['l'].replace(',', '')),
3232
np.datetime64(parse(x['lt']).isoformat())]
3333
for x in result], columns=['change_pct',
3434
'last', 'time'],

0 commit comments

Comments
 (0)