Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:48:23+00:00 2026-06-06T13:48:23+00:00

Suppose my program creates a large array of data which I then save with

  • 0

Suppose my program creates a large array of data which I then save with numpy’s savez routine. However, I’d also like to store some additional information together with that array. Examples would be the git commit id of the current version, and the input parameters used to generate the data so that later I can look at the data and know exactly how I created it.

Is there a way to save this information directly together with the array in a npz file, or would I have to create a separate file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:48:27+00:00Added an answer on June 6, 2026 at 1:48 pm

    You should be able to:

    In [2]: a = np.arange(10)
    
    In [3]: b = 'git push'
    
    In [5]: np.savez('file',a=a,b=b)
    
    In [7]: data = np.load('file.npz')
    
    In [8]: data.keys()
    Out[8]: ['a', 'b']
    
    In [9]: data['a']
    Out[9]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
    
    In [10]: str(data['b'])
    Out[10]: 'git push'
    

    So you can save arbitrary named data and get a dictionary-like object out. Perhaps a better format to use that may be more flexible and has built in support for all sorts of metadata is hdf5 using either h5py or pytables:

    http://h5py.alfven.org/docs/

    http://www.pytables.org/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a simple program which suppose to accept txt file data from
suppose that no bytecode is generated for a program, like in Ruby, Perl, or
So suppose I'm developing a chess-like program using Java's Swing. I added a MouseListener
Suppose in a program we have implemented a stack. But who creates the stack
Suppose I have an SConstruct file that looks like this: env = Environment() env.Program(a,
I've created an applet which has one large panel to display data surrounded by
I've got one program which creates 3 worker programs. The preferable method of communication
Suppose I have a SQL database in which a column could look something like
I have an AppleScript program which creates XML tags and elements within an Adobe
My program is suppose to count the occurrence of each character in a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.