Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
プログラムにバグがあることに気付きました。その理由は、pandas が値ではなく pandas データフレームを参照してコピーしているように見えるためです。不変オブジェクトは常に参照渡しされることはわかっていますが、pandas データフレームは不変ではないため、なぜ参照渡しなのかわかりません。誰でも情報を提供できますか?
ありがとう!アンドリュー
Python のすべての関数は「参照渡し」であり、「値渡し」はありません。pandas オブジェクトの明示的なコピーを作成する場合は、 を試してくださいnew_frame = frame.copy()。
new_frame = frame.copy()