Comments (12)
Github kind of muddled the code formatting, I tried to format it. Did I get the test case right?
from blaze.
No, I have updated it correctly now. BTW, I like this single liner:
if os.path.exists(path): shutil.rmtree(path)
but probably you don't :)
from blaze.
I can reproduce this issue. It's definitely in Blaze, seems carray does the correct thing.
from blaze.
I've started playing with blaze, as I will start making extra tests for the persistence layer. There seems to be related problems that do not involve persistence at all. The following code may serve as a hint of what's going wrong:
>>> ds = dshape('2,2,int')
>>> a = Array(range(4), ds)
>>> a
Array
datashape := 2, 2, int
values := [CArray(ptr=4328095024)]
metadata := [manifest, arraylike]
layout := Chunked(dim=0)
[0 1 2 3] <---- looks dodgy... shouldn't it be "[[0 1] [2 3]]" ???
>>> a[2]
array(2) <--- dodgy... bad indexing for a (2,2) array, right?
>>> a[0][0]
IndexError: 0-d arrays can't be indexed
from blaze.
Another update. It seems it is related to the Array constructor.
zeros and ones do result in proper arrays. However, Array looks very dodgy right now:
In [101]: Array(np.eye(6), dshape('2, 2, float64'))
Out[101]:
Array
datashape := 2, 2, float64
values := [CArray(ptr=4328164448)]
metadata := [manifest, arraylike]
layout := Chunked(dim=0)
[ 1. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0.
0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 1.]
It seems that it just takes whatever values you pass in the first parameter and makes it a 1-d array out of it. The datashape seems ignored other than to set the datashape attribute. Note that in the example even the the size of the initial data is wrong and is preserved (it enumerates all 36 elements, even as from the datashape point of view only 4 should be present...)
from blaze.
Yeah there is something weird going on in the constructor, especially if you try interpret a numpy array in terms of a datashape that doesn't make sense in terms of the input object. Most of the array objects feed into either numpy or carray and read off the shapes and dtype and then upconvert into datashape as stop-gap measure... seems like its time to remove the stop-gaps and write a proper constructor function.
from blaze.
Ok, I've traced back the problem to carray.
It seems that when the carray is built providing a dtype, it loses the shape of the original array. It seems this is causing this bug.
I am going to add tests in carray to check this code, and try to fix it.
from blaze.
Fixed on commit
f896163 FIX: github blaze issue #14. carray now preserves dimensionality when an732a378 added test_queries from carray
In persist branch
from blaze.
Want to just merge this to trunk whenever you feel the branch is in a good place?
from blaze.
That would be fine. I may just push the whole branch as well... as it only adds the fix and some extra unit-tests for carray.
Right now I am adding a test case for this issue, So I will wait till that one is ready.
from blaze.
The fix needs extra polish
from blaze.
This was fixed in a definitive way. It is in the persist branch
from blaze.
Related Issues (20)
- Are there any solutions for a Blaze ecosystem like hadoop? HOT 1
- networkx 2.0 api changes HOT 2
- Transitioning the Blaze project HOT 11
- Separate backends from core HOT 1
- `by` ignores the join condition
- dshape does not stick in bz.Data(...) HOT 13
- Blaze to RESTful endpoint
- (sqlite3.OperationalError) no such function: greatest HOT 1
- ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216
- removing redundancy
- Filtering with `by` ignores the group by condition HOT 1
- Dependency on pandas tslib HOT 1
- Fix simple typo: absense -> absence
- Unable to install pyhive from Anaconda Prompt HOT 1
- Importing ABC from collections was removed in Python 3.9
- Deprecation warning due to invalid escape sequences in Python 3.8
- BUG:TypeError: Cannot interpret 'CategoricalDtype(categories=['no', 'yes'], ordered=False)' as a data type
- Data analytics
- Is Blaze dead ?
- Blaze version issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blaze.