Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Dictionary or Numpy Array?
First, can someone please show the proper code for creating a 5 row 2 column numpy array with type python object?
I see a lot of info online but none of it seems to quite show how to do that in one example.

If I want to have a string for a key and a number for a value, is Dictionary faster or is it really worth it to to build a numpy array? There will be over 450 000 keys btw. I'm doing quadragrams.

I think this Stack Overflow question has what you want.

I would use a dictionary. I believe the numpy array is meant to optimize certain list operations, not dictionary operations.
jarrod0987 likes this post
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Seems to be what I wanted. Thanks

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  memory issue loading movie to numpy array djf123 1 43 Nov-07-2019, 06:19 AM
Last Post: ThomasL
  Numpy structured array Nitram 3 218 Sep-17-2019, 10:09 PM
Last Post: jefsummers
  numpy.copy / numpy.delete paul18fr 3 260 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 4,065 May-29-2019, 02:48 AM
Last Post: heiner55
  Array in numpy Truman 5 4,104 May-26-2019, 10:14 AM
Last Post: snippsat
  [split] Array in numpy aapurdel 1 279 May-25-2019, 08:05 PM
Last Post: buran
  [numpy]add a value to an array elmismo999 1 363 May-23-2019, 04:15 PM
Last Post: michalmonday
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 405 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  while creating a array using numpy.arrange, how to negate only the last 50 numbers? vicky53 1 403 Apr-06-2019, 11:52 AM
Last Post: scidam
  How to get the size of a numpy array? mcgrim 2 453 Mar-23-2019, 02:25 PM
Last Post: perfringo

Forum Jump:

Users browsing this thread: 1 Guest(s)