correctly support writing pd.Series and pd.DataFrame#31
correctly support writing pd.Series and pd.DataFrame#31briancappello wants to merge 6 commits intoalpacahq:masterfrom
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 |
| 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.
Pandas is 3.5+
| ## 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.
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. Meanwhilememoryviewon 3.x doesn't complain, butbufferon 2.x blows up. Anyway, tests pass now.