title: How to save the results of an np.array for future use when using Google Colab
body: <p>I am working on a project of Information Retrieval. For that I am using Google Colab. I am in the phase where I have computed some features ("<strong>input_features</strong>") and I have the labels ("<strong>labels</strong>") by doing a for loop, which took me about 4 hours to finish.</p>
  
  <p>So at the end I have appended the results to an array:</p>
  
  <pre><code>input_features = np.array(input_features)
  labels = np.array(labels)
  </code></pre>
  
  <p><strong>So my question would be</strong>:
  Is it possible to save those results in order to use them future purposes when using google colab?</p>
  
  <p>I have found 2 options that maybe could be applied but I don't know where these files are created.</p>
  
  <p>1) To save them as csv files. And my code would be:</p>
  
  <pre><code>from numpy import savetxt
  # save to csv file
  savetxt('input_features.csv', input_features, delimiter=',')
  savetxt('labels.csv', labels, delimiter=',')
  </code></pre>
  
  <p>And in order to load them:</p>
  
  <pre><code>from numpy import loadtxt
  # load array
  input_features = loadtxt('input_features.csv', delimiter=',')
  labels = loadtxt('labels.csv', delimiter=',')
  # print the array
  print(input_features)
  print(labels)
  </code></pre>
  
  <p>But still I don't get something back when I print.</p>
  
  <hr>
  
  <p>2) Save the results of an array by using pickle where I followed these instructions from here: 
  <a href="https://colab.research.google.com/drive/1EAFQxQ68FfsThpVcNU7m8vqt4UZL0Le1#scrollTo=gZ7OTLo3pw8M" rel="nofollow noreferrer">https://colab.research.google.com/drive/1EAFQxQ68FfsThpVcNU7m8vqt4UZL0Le1#scrollTo=gZ7OTLo3pw8M</a></p>
  
  <pre><code>from google.colab import files
  import pickle
  def features_pickeled(input_features, results):
    input_features = input_features + '.txt'
    pickle.dump(results, open(input_features, 'wb'))
    files.download(input_features)
  def labels_pickeled(labels, results):
    labels = labels + '.txt'
    pickle.dump(results, open(labels, 'wb'))
    files.download(labels)
  </code></pre>
  
  <p>And to load them back:</p>
  
  <pre><code>def load_from_local():
    loaded_features = {}
    uploaded = files.upload()
    for input_features in uploaded.keys():
        unpickeled_features = uploaded[input_features]
        loaded[input_features] = pickle.load(BytesIO(data)) 
    return loaded_features 
  def load_from_local():
    loaded_labels = {}
    uploaded = files.upload()
    for labels in uploaded.keys():
        unpickeled_labels = uploaded[labels]
        loaded[labels] = pickle.load(BytesIO(data))
    return loaded_labes
  
  #How do I print the pickled files to see if I have them ready for use???
  </code></pre>
  
  <hr>
  
  <p>When using python I would do something like this for pickle:</p>
  
  <pre><code>#Create pickle file
  with open("name.pickle", "wb") as pickle_file:
       pickle.dump(name, pickle_file)
  #Load the pickle file
  with open("name.pickle", "rb") as name_pickled:
       name_b = pickle.load(name_pickled)
  </code></pre>
  
  <hr>
  
  <p>But the thing is that I don't see any files to be created in my google drive. </p>
  
  <p>Is my code correct or do I miss some part of the code? </p>
  
  <p>Long description in order to hopefully have explained in detail what I want to do and what I have done for this issue.</p>
  
  <p>Thank you in advance for your help.</p>