title: Can memmap pandas series. What about a dataframe?
body: <p>It seems that I can memmap the underlying data for a python series by creating a mmap'd ndarray and using it to initialize the Series.</p>
  
  <pre><code>        def assert_readonly(iloc):
             try:
                 iloc[0] = 999 # Should be non-editable
                 raise Exception("MUST BE READ ONLY (1)")
             except ValueError as e:
                 assert "read-only" in e.message
  
          # Original ndarray
          n = 1000
          _arr = np.arange(0,1000, dtype=float)
  
          # Convert it to a memmap
          mm = np.memmap(filename, mode='w+', shape=_arr.shape, dtype=_arr.dtype)
          mm[:] = _arr[:]
          del _arr
          mm.flush()
          mm.flags['WRITEABLE'] = False  # Make immutable!
  
          # Wrap as a series
          s = pd.Series(mm, name="a")
          assert_readonly(s.iloc)
  </code></pre>
  
  <p>Success! Its seems that <code>s</code> is backed by a read-only mem-mapped ndarray.
  Can I do the same for a DataFrame? The following fails</p>
  
  <pre><code>        df = pd.DataFrame(s, copy=False, columns=['a'])
          assert_readonly(df["a"]) # Fails
  </code></pre>
  
  <p>The following succeeds, but only for one column:</p>
  
  <pre><code>        df = pd.DataFrame(mm.reshape(len(mm,1)), columns=['a'], copy=False)
          assert_readonly(df["a"]) # Succeeds
  </code></pre>
  
  <p>... so I <em>can</em> make a DF without copying. However, this only works for one column, and I want many. Method I've found for combining 1-column DFs: pd.concat(..copy=False), pd.merge(copy=False), ... result in copies.</p>
  
  <p>I have some thousands of large columns as datafiles, of which I only ever need a few at a time. I was hoping I'd be able to place their mmap'd representations in a DataFrame as above. Is it possible?</p>
  
  <p>Pandas documentation makes it a little difficult to guess about what's going on under the hood here - although it does say a DataFrame <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html" rel="noreferrer">"Can be thought of as a dict-like container for Series objects."</a>. I'm beginning to this this is no longer the case.</p>
  
  <p>I'd prefer not to need HD5 to solve this.</p>