How to get the size of a numpy array?
 How to get the size of a numpy array? mcgrim Spam, spam, eggs, and spam Posts: 203 Threads: 41 Joined: Mar 2019 Reputation: 0 Mar-23-2019, 02:05 PM (This post was last modified: Mar-23-2019, 02:26 PM by Yoriz.) I am having some problems with this task. I am supposed to use the command range to generate a list of 100 numbers between 0 and 1 (both 0 and 1 should be included) and a list comprehension. I have tried by using np.arange, but as a fairly new user, I am not sure if is the same thing as range. I have tried to use 'range' before but it does not work with floats. Since the numbers needed to be generated must be 100, I have tried to look for a specific command that allows me to find out how many numbers are generated, but I haven't had any success. Here is the code: ```import numpy as np from scipy import * from numpy import array for i in np.arange(0, 1.01, 0.0101): print(i, end=', ') ``` Reply Posts: 1,543 Threads: 30 Joined: Sep 2016 Reputation: 162 Mar-23-2019, 02:24 PM `np.size(nparray)` Reply perfringo Da Bishop Posts: 1,593 Threads: 7 Joined: Jun 2018 Reputation: 154 Mar-23-2019, 02:25 PM “100 numbers between 0 and 1 (both 0 and 1 should be included)” I observe that if evenly distributed there will be 101 numbers: 0, 0.01, 0.02, .... 0.99, 1 I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame. Reply

 Possibly Related Threads… Thread Author Replies Views Last Post How to fill datetime64 field in numpy structured array? AlekseyPython 0 115 Oct-20-2020, 08:17 AM Last Post: AlekseyPython Adding data in 3D array from 2D numpy array asmasattar 0 424 Jul-23-2020, 10:55 AM Last Post: asmasattar cannot reshape array of size 0 into shape Roro 2 1,260 Jun-14-2020, 11:28 AM Last Post: Roro converting dataframe to int numpy array glennford49 1 486 Apr-04-2020, 06:15 AM Last Post: snippsat Replacing sub array in Numpy array ThemePark 5 684 Apr-01-2020, 01:16 PM Last Post: ThemePark How to prepare a NumPy array which include float type array elements subhash 0 407 Mar-02-2020, 06:46 AM Last Post: subhash numpy.where array search for string in just one coordinate adetheheat 1 579 Jan-09-2020, 07:09 PM Last Post: paul18fr memory issue loading movie to numpy array djf123 1 495 Nov-07-2019, 06:19 AM Last Post: ThomasL Numpy structured array Nitram 3 797 Sep-17-2019, 10:09 PM Last Post: jefsummers AttributeError: module 'numpy' has no attribute 'array aapurdel 7 17,987 May-29-2019, 02:48 AM Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020