-
Notifications
You must be signed in to change notification settings - Fork 41
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
correctly support writing pd.Series and pd.DataFrame #31
correctly support writing pd.Series and pd.DataFrame #31
Conversation
I'm happy to add tests for this code too, but it will have to be tomorrow - feeling like it's bed time for me tonight |
Thanks for the work. Yes I want to see tests and README update as well, and don't rush |
@@ -5,7 +5,7 @@ Build Status: ![build status](https://circleci.com/gh/alpacahq/pymarketstore/tre | |||
|
|||
Pymarketstore can query and write financial timeseries data from [MarketStore](https://github.com/alpacahq/marketstore) | |||
|
|||
Tested with 2.7, 3.3+ | |||
Tested with Python 2.7, 3.5+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pandas is 3.5+
@@ -68,43 +68,48 @@ Construct a client object with endpoint. | |||
|
|||
## Query | |||
|
|||
`pymkts.Client#query(symbols, timeframe, attrgroup, start=None, end=None, limit=None, limit_from_start=False)` | |||
`pymkts.Client.query(symbols, timeframe, attrgroup, start=None, end=None, limit=None, limit_from_start=False)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed all of these to dots, feels more "Pythonic" to me, but I'm not especially attached to it either.
@umitanuki Added tests and updated the README, so this branch should be ready for review |
Any update on this? |
Finally got some time to play around with this some more. I'm not sure yet exactly where things are going wrong but it seems like marketstore@master might have bugs with writing or reading As it is right now, the client needs to know which types the backend is using to persist data on disk. (eg if the first write for a symbol used Updating // Check if the previously-written data schema matches the input
columnMismatchError := "unable to match data columns (%v) to bucket columns (%v)"
dbDSV := tbi.GetDataShapesWithEpoch()
csDSV := cs.GetDataShapes()
if len(dbDSV) != len(csDSV) {
return fmt.Errorf(columnMismatchError, csDSV, dbDSV)
}
missing, coercion := GetMissingAndTypeCoercionColumns(dbDSV, csDSV)
- if missing != nil || coercion != nil {
+ if missing != nil {
return fmt.Errorf(columnMismatchError, csDSV, dbDSV)
}
+ if coercion != nil {
+ for _, shape := range coercion {
+ cs.CoerceColumnType(shape)
+ }
+ } If you write new What I've done locally is just to use pandas to convert types to |
Replaced by #55 |
@umitanuki This PR replaces #27, fixes #30
I still don't understand why, but on 2.7, it appears arrays need to coerced to be contiguous. What's bizarre is that if you
print(entire_dataset.flags)
it says it is contiguous on both 2.x and 3.x. If instead you doprint(entire_dataset[colname].flags)
it says it isn't contiguous on both 2.x and 3.x. Meanwhilememoryview
on 3.x doesn't complain, butbuffer
on 2.x blows up. Anyway, tests pass now.