is there a way to convert a 2d array into a 1d array with sql? see picture and example below.
basically in the collapse column (see attached screenshot), instead of having array(array(int)), i'd need array(int) - so instead of [[0,0,0],[0,0,0]], i'd need [0,0,0,0,0,0]
I've resolved this by using flatten function
Related
I have a table with some missing values which I want to find via interpolation.
Which bring me down to two questions. Is it better to input the a values into a 2D array or into a dataframe? (I am still a bit of a novice with this sort of scripts). And what would be the best way to do 2D interpolation accordingly for the missing values?
I have worked on lists in g1ant but lists are 1D array, now I want to work on 2D array but I don't know how to do that it g1ant. Is there any way of doing it?
At the current state of G1ANT, it is not possible to create a 2D array as a g1ant structure. Although you can use C# snippets in which it is possible to create 2D arrays and operate on them.
I want to have a 2D Matrix and then fill the elements of this matrix with different values. I know that I need to create a matrix first with the following definition:
Matrix = np.zeros(10,10)
Now my question is how I can fill of the elements of this matrix by a value lets say the element of [4][7] with value of 5. Thanks
Be careful, because the right sintax for a 10x10 matrix filled by zeros is Matrix = np.zeros((10,10)). Then you can simply write in a different line Matrix[4][7] = 5. I advice you to read a tutorial or a introductory book on Python.
I have a .vtu file composed of tetrahedral and triangular elements (located on an outer surface). I also have a celldata field (for example, nrc1) defined on the triangular elements and being zero in the tetrahedral ones. When I select to plot this field in Paraview, I only see a zero field, corresponding with the 3D elements, but no trace of the field in the 2D elements.
Is there a way to show that 2D field in Paraview?
P.D.: I cannot interpolate the 2D celldata field into a pointdata one, since part of the information (discontinuities,...) would be lost.
There is indeed a conflict between the information on the 3D cells (zeroes) and information on the 2D cells (actual information), where the 2D cells and the 3D cells overlap.
Even though your dataset is valid, mixed dimension dataset are not easy to manage correctly, hence your issue.
In any case, you should extract your 2D cells to be able to visualize your data correctly, here is how I would do it :
Create a new view, click on Spreadsheet view
show your dataset in the spreadsheet view
order by CellType
Manually select all 2D CellType has they will be located together
Add an Extract Selection filter, Apply
You can now visualize your data on this 2D cells only dataset
You could also use Edit->Find Data and select by ID since your cells seems to be ordoned.
Finally, you could write a small Python Programmable Filter to do all that for you completelly automatically, but it is not very easy to implement.
a=np.array([1,2,3])
b=np.array([5,6,7,8])
c=np.array([8])
d=9
I want to composite a new array:
np.array([2,7,8,8,9])
So type code :
newlist=np.concatenate((a[1],b[2:4],c,d))
But hint error:
ValueError: zero-dimensional arrays cannot be concatenated
Is single value that sliced from a np.array regarded as one dimesional array or a number?
In general, How to compose number and one dimensional array into an one demension array or list?
Just change np.concatenate() into np.hstack():
np.hstack((a[1],b[2:4],c,d))
np.hstack() takes a sequence of arrays and stacks them horizontally to make a single array.