Skip to content

BUG: Google finance is returning object dtype data (rather than float) #3995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jreback opened this issue Jun 22, 2013 · 8 comments · Fixed by #8792
Closed

BUG: Google finance is returning object dtype data (rather than float) #3995

jreback opened this issue Jun 22, 2013 · 8 comments · Fixed by #8792
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions IO Data IO issues that don't fit into a more specific label
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Jun 22, 2013

No description provided.

@cpcloud
Copy link
Member

cpcloud commented Jun 23, 2013

do u want to put this under cleanup data.py? i can take it on

@cpcloud
Copy link
Member

cpcloud commented Jun 23, 2013

or rather should i mention it in the pr?

@jreback
Copy link
Contributor Author

jreback commented Jun 23, 2013

u can move 2 your cleanup of data
but can leave most/all of that till 0.12

@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2013

I think this just needs a conversion:

In [28]: x = web.get_data_google(['IBM','INTC'],'1/1/2010','1/1/2013')
x

In [29]: x
Out[29]: 
<class 'pandas.core.panel.Panel'>
Dimensions: 5 (items) x 761 (major_axis) x 2 (minor_axis)
Items axis: Open to Volume
Major_axis axis: 2010-01-01 00:00:00 to 2012-12-31 00:00:00
Minor_axis axis: IBM to INTC

In [30]: x.loc[:,:,'IBM']
Out[30]: 
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 761 entries, 2010-01-01 00:00:00 to 2012-12-31 00:00:00
Data columns (total 5 columns):
Open      761  non-null values
High      761  non-null values
Low       761  non-null values
Close     761  non-null values
Volume    761  non-null values
dtypes: object(5)

In [31]: x.loc[:,:,'IBM'].head()
Out[31]: 
              Open    High     Low   Close   Volume
Date                                              
2010-01-01       -       -       -   130.9        0
2010-01-04  131.18  132.97  130.85  132.45  6155846
2010-01-05  131.68  131.85  130.10  130.85  6842471
2010-01-06  130.68  131.49  129.81     130  5605290
2010-01-07  129.87  130.25  128.91  129.55  5840569

In [32]: x.loc[:,:,'IBM'].dtypes
Out[32]: 
Open      object
High      object
Low       object
Close     object
Volume    object
dtype: object

In [34]: x.loc[:,:,'IBM'].convert_objects(convert_numeric='force')
Out[34]: 
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 761 entries, 2010-01-01 00:00:00 to 2012-12-31 00:00:00
Data columns (total 5 columns):
Open      754  non-null values
High      754  non-null values
Low       754  non-null values
Close     761  non-null values
Volume    761  non-null values
dtypes: float64(4), int64(1)

In [35]: x.loc[:,:,'IBM'].convert_objects(convert_numeric='force').head()
Out[35]: 
              Open    High     Low   Close   Volume
Date                                              
2010-01-01     NaN     NaN     NaN  130.90        0
2010-01-04  131.18  132.97  130.85  132.45  6155846
2010-01-05  131.68  131.85  130.10  130.85  6842471
2010-01-06  130.68  131.49  129.81  130.00  5605290
2010-01-07  129.87  130.25  128.91  129.55  5840569

@jreback jreback modified the milestones: 0.15.0, 0.14.0 Feb 14, 2014
@davidastephens
Copy link
Contributor

This looks to have been fixed. get_data_google returns floats instead of objects.

x = web.get_data_google(['IBM'],'1/1/2010','1/1/2014')

x.loc[:,:,'IBM'].head()
Out[19]: 
              Open    High     Low   Close   Volume
Date                                              
2010-01-04  131.18  132.97  130.85  132.45  6155846
2010-01-05  131.68  131.85  130.10  130.85  6842471
2010-01-06  130.68  131.49  129.81  130.00  5605290
2010-01-07  129.87  130.25  128.91  129.55  5840569
2010-01-08  129.07  130.92  129.05  130.85  4197105

x.dtypes
Out[20]: 
Open      float64
High      float64
Low       float64
Close     float64
Volume    float64
dtype: object

@jreback
Copy link
Contributor Author

jreback commented Nov 11, 2014

@dstephens99 can you put up a validation test so we can close?

@jreback jreback modified the milestones: 0.15.2, 0.16.0 Nov 11, 2014
@davidastephens
Copy link
Contributor

Sure. Do you want a mention in whats new as well?

@jreback
Copy link
Contributor Author

jreback commented Nov 11, 2014

sure you can mention. Also if you can figure out when this was fixed (e.g. use git blame), you can say, fixed in version 0.14.1...or whatever (if not ok too). But goes in 0.15.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants