0

Is there any way to share the memory/data contained in a dataframe with another item? I naively tried this using memoryview, but I think it's quite a bit more complex than this (or possibly not supported at all):

>>> import pandas as pd
>>> df=pd.DataFrame([{'Name':'Brad'}])
>>> v=memoryview(df)

TypeError: cannot make memory view because object does not have the buffer interface

David542
  • 104,438
  • 178
  • 489
  • 842
  • 1
    Why exactly do you need to share memory? If you are not mutating the dataframe, you can just copy the reference to it `df2 = df` or use `df2 = df.copy(deep=True)` if you want to completely copy the data or with `deep=False` to make a shallow copy. If you are memory constrained, you might want to look at loading data in chunks or using a library like `dask.frame`. – Noah May Dec 27 '20 at 07:07
  • Does [this](https://stackoverflow.com/a/62781869/1453508) help? – David M. Dec 28 '20 at 11:24

0 Answers0