title: python - saving numpy array to a file (smallest size possible)
body: <p>Right now I have a python program building a fairly large 2D numpy array and saving it as a tab delimited text file using numpy.savetxt.  The numpy array contains only floats.  I then read the file in one row at a time in a separate C++ program.</p>
  
  <p>What I would like to do is find a way to accomplish this same task, changing my code as little as possible such that I can decrease the size of the file I am passing between the two programs.  </p>
  
  <p>I found that I can use numpy.savetxt to save to a compressed .gz file instead of a text file.  This lowers the file size from ~2MB to ~100kB.  </p>
  
  <p>Is there a better way to do this?  Could I, perhaps, write the numpy array in binary to the file to save space?  If so, how would I do this so that I can still read it into the C++ program?</p>
  
  <p>Thank you for the help.  I appreciate any guidance I can get.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>There are a lot of zeros (probably 70% of the values in the numpy array are 0.0000) I am not sure of how I can somehow exploit this though and generate a tiny file that my c++ program can read in</p>