Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Dictionary or Numpy Array?
#1
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.

Second,
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.

Thanks
Quote
#2
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 - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote
#3
Seems to be what I wanted. Thanks
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  converting dataframe to int numpy array glennford49 1 237 Apr-04-2020, 06:15 AM
Last Post: snippsat
  Replacing sub array in Numpy array ThemePark 5 304 Apr-01-2020, 01:16 PM
Last Post: ThemePark
  How to prepare a NumPy array which include float type array elements subhash 0 219 Mar-02-2020, 06:46 AM
Last Post: subhash
  numpy.where array search for string in just one coordinate adetheheat 1 353 Jan-09-2020, 07:09 PM
Last Post: paul18fr
  memory issue loading movie to numpy array djf123 1 282 Nov-07-2019, 06:19 AM
Last Post: ThomasL
  Numpy structured array Nitram 3 560 Sep-17-2019, 10:09 PM
Last Post: jefsummers
  numpy.copy / numpy.delete paul18fr 3 637 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 12,388 May-29-2019, 02:48 AM
Last Post: heiner55
  Array in numpy Truman 5 4,791 May-26-2019, 10:14 AM
Last Post: snippsat
  [split] Array in numpy aapurdel 1 504 May-25-2019, 08:05 PM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)