Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

396
Views
How to store NumPy arrays in PostgreSQL database?

Currently, I am creating .npz compressed files for storing large NumPy arrays. So every time I need to load the array from file and since it's a frequent process, I was thinking to store the NumPy array in the database. I am using the PostgreSQL database.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You could do this with a bytea column (it can store arbitrary binary). You can use pickle.dumps to turn your numpy array into a binary string and insert into postgres however you like. You can then go select that data and use pickle.loads to get your array back. Here's an answer to a similar question: https://stackoverflow.com/a/57644761/7386185

Depending on how large the array is, you might want to consider some kind of blob storage like amazon S3.

If you're frequently accessing this data and this is a production environment, you might want to consider keeping this data in-memory. If your array is large enough that you can't keep it around in memory too long, then you should consider if your application will allow for streaming of your data in batches or a buffer.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!