OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How do I declare a numpy array to be 1 dimensional of arbitrary length?

  • Thread starter Thread starter Chechy Levas
  • Start date Start date
C

Chechy Levas

Guest
I am working on a python code base and the team has decided to make everything statically typed. I want to declare a numpy array of floats to be one dimension, with arbitrary length. I currently have the following:

Code:
float64 = np.dtype[np.float64]
floats = np.ndarray[Any, float64]

What exactly is the role of Any in this case? Does this declaration permit multi-dimensional arrays? How do I statically differentiate between 1, 2, or 3 dimensional arrays?
<p>I am working on a python code base and the team has decided to make everything statically typed.
I want to declare a numpy array of floats to be one dimension, with arbitrary length.
I currently have the following:</p>
<pre><code>float64 = np.dtype[np.float64]
floats = np.ndarray[Any, float64]
</code></pre>
<p>What exactly is the role of <code>Any</code> in this case? Does this declaration permit multi-dimensional arrays? How do I statically differentiate between 1, 2, or 3 dimensional arrays?</p>
 

Latest posts

M
Replies
0
Views
1
MOHAMED AMIIN ABDI AADAN
M
Top