Python Forum
DataFrame operations didn't change orginal
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataFrame operations didn't change orginal
#4
(Jan-10-2021, 12:27 PM)jefsummers Wrote: It would help to have the whole error message, so we can see where this is happening.

I believe the issue is the way Python handles variable names. a=b does not copy b to a, rather it creates variable a that points to the same value that b does. Changes to that value mean that a and b are both changed. Usually. Unless the operation results in a reassignment that separates the two.

Sounds confusing, would refer you to a Pycon talk by Ned Batchelder PyCon 2015

edited orginal massage and add whole error massage

i understand change issue. but in my example it didnt change. i trace step by step DF.shape and after "line 22" it change to its orginal value Angry so the alterations that i make is gone.
Reply


Messages In This Thread
RE: DataFrame operations didn't change orginal - by HoldYourBreath - Jan-10-2021, 12:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Change a numpy array to a dataframe Led_Zeppelin 3 1,155 Jan-26-2023, 09:01 PM
Last Post: deanhystad
Question Sqlite3 how to know when cursor.execute didn't return anything ? SpongeB0B 2 893 Dec-18-2022, 06:13 PM
Last Post: deanhystad
  How to change UTC time to local time in Python DataFrame? SamKnight 2 1,658 Jul-28-2022, 08:23 AM
Last Post: Pedroski55
  Replicate Excel operations with Python Lumberjack 3 1,867 May-10-2022, 01:44 AM
Last Post: Lumberjack
  code running for more than an hour now, yet didn't get any result, what should I do? aiden 2 1,553 Apr-06-2022, 03:41 PM
Last Post: Gribouillis
  Program demonstrates operations of bitwise operators without using bitwise operations ShawnYang 2 1,819 Aug-18-2021, 03:06 PM
Last Post: deanhystad
  Variable scope - "global x" didn't work... ptrivino 5 3,097 Dec-28-2020, 04:52 PM
Last Post: ptrivino
  pandas change value two dataframe nio74maz 4 2,785 Dec-25-2020, 05:25 PM
Last Post: nio74maz
  How to change row 2 to column header within a dataframe sparkt 2 2,183 Aug-20-2020, 05:12 PM
Last Post: sparkt
  Random Choice Operations Souls99 6 2,983 Jul-31-2020, 10:37 PM
Last Post: Souls99

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020