Python Forum
Copy a column from one dataframe to another dataframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy a column from one dataframe to another dataframe
#11
df1=df does not copy df into a new dataframe df1, despite that being what it looks like. Instead, you simply have 2 variables pointing to the same dataframe. You need to use the copy() command

See Documentation
Reply


Messages In This Thread
RE: Copy a column from one dataframe to another dataframe - by jefsummers - Jul-07-2022, 07:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries sawtooth500 14 661 Apr-24-2024, 01:42 AM
Last Post: sawtooth500
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 310 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon
  Elegant way to apply each element of an array to a dataframe? sawtooth500 7 477 Mar-29-2024, 05:51 PM
Last Post: deanhystad
  Dataframe copy warning sawtooth500 4 400 Mar-25-2024, 11:38 PM
Last Post: sawtooth500
  FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries i sawtooth500 3 1,544 Mar-22-2024, 03:08 AM
Last Post: deanhystad
  Adding PD DataFrame column bsben 2 353 Mar-08-2024, 10:46 PM
Last Post: deanhystad
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 771 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  Comparing Dataframe to String? RockBlok 2 441 Nov-24-2023, 04:55 PM
Last Post: RockBlok
  Filter data into new dataframe as main dataframe is being populated cubangt 8 1,047 Oct-23-2023, 12:43 AM
Last Post: cubangt
  DataFRame.concat() nafshar 3 818 Jul-14-2023, 04:41 PM
Last Post: nafshar

Forum Jump:

User Panel Messages

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