File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,12 @@ def test_get_quote_stringlist(self):
171
171
df = web .get_quote_yahoo (['GOOG' , 'AAPL' , 'GOOG' ])
172
172
assert_series_equal (df .ix [0 ], df .ix [2 ])
173
173
174
+ def test_get_quote_comma_name (self ):
175
+ _yahoo_codes .update ({'name' : 'n' })
176
+ df = web .get_quote_yahoo (['RGLD' ])
177
+ del _yahoo_codes ['name' ]
178
+ self .assertEqual (df ['name' ][0 ], 'Royal Gold, Inc.' )
179
+
174
180
def test_get_components_dow_jones (self ): # pragma: no cover
175
181
raise nose .SkipTest ('unreliable test, receive partial components back for dow_jones' )
176
182
Original file line number Diff line number Diff line change 1
1
from collections import defaultdict
2
+ import csv
3
+
2
4
import pandas .compat as compat
3
5
from pandas .io .common import urlopen
4
6
from pandas import DataFrame
@@ -37,9 +39,12 @@ def _get_data(symbols):
37
39
with urlopen (url ) as response :
38
40
lines = response .readlines ()
39
41
40
- for line in lines :
41
- fields = line .decode ('utf-8' ).strip ().split (',' )
42
- for i , field in enumerate (fields ):
42
+ def line_gen (lines ):
43
+ for line in lines :
44
+ yield line .decode ('utf-8' ).strip ()
45
+
46
+ for line in csv .reader (line_gen (lines )):
47
+ for i , field in enumerate (line ):
43
48
if field [- 2 :] == '%"' :
44
49
v = float (field .strip ('"%' ))
45
50
elif field [0 ] == '"' :
You can’t perform that action at this time.
0 commit comments