python pandas dataframe, is it pass-by-value or pass-by-reference

后端 未结 6 876
陌清茗
陌清茗 2020-12-02 05:58

If I pass a dataframe to a function and modify it inside the function, is it pass-by-value or pass-by-reference?

I run the following code

a = pd.Data         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 06:30

    Here is the doc for drop:

    Return new object with labels in requested axis removed.

    So a new dataframe is created. The original has not changed.

    But as for all objects in python, the data frame is passed to the function by reference.

提交回复
热议问题