How to create a view of dataframe in pandas?

后端 未结 1 1134
小蘑菇
小蘑菇 2021-01-04 01:22

I have a large dataframe (10m rows, 40 columns, 7GB in memory). I would like to create a view in order to have a shorthand name for a view that is complicated to express, wi

相关标签:
1条回答
  • 2021-01-04 01:55

    You generally can't return a view.

    Your answer lies in the pandas docs: returning-a-view-versus-a-copy.

    Whenever an array of labels or a boolean vector are involved in the indexing operation, the result will be a copy. With single label / scalar indexing and slicing, e.g. df.ix[3:6] or df.ix[:, 'A'], a view will be returned.

    This answer was found in the following post: Link.

    0 讨论(0)
提交回复
热议问题