Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:24:43+00:00 2026-06-13T11:24:43+00:00

I have a dataframe with two columns each of which represents an organism. They

  • 0

I have a dataframe with two columns each of which represents an organism. They are called ORG1 and ORG2
I want to move the values of ORG2 into ORG1 for the corresponding index value.

So, if ORG1 is ‘A’ and ORG2 is ‘B’ I want ORG1 to take the value ‘B’ from ORG2.

I have already started work to identify indexes of the ORG2 organisms that I want to move, as follows:

def move_org2(x):
    org2_matches = Series(x.ORG2.str.count("ESBL"))
    return x.ix[org2_matches == 1]

org2_DF = move_org2(DF)

org2_DF.ORG2.index

What is the best way to use this to change ORG1 values with the values at corresponding ORG2 indices

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:24:44+00:00Added an answer on June 13, 2026 at 11:24 am
    In [13]: df
    Out[13]:
      ORG1  ORG2
    0    A  ESBL
    1    B     P
    2    C     Q
    3    D     R
    4    E  ESBL
    
    In [14]: cond = df.ORG2 == 'ESBL'
    
    In [15]: df.ORG1[cond] = df.ORG2[cond]
    
    In [16]: df
    Out[16]:
       ORG1  ORG2
    0  ESBL  ESBL
    1     B     P
    2     C     Q
    3     D     R
    4  ESBL  ESBL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a two column dataframe in R and i want to add a
I have a state column in a dataframe and I want to create two
I have two dataframes and I wish to insert the values of one dataframe
Say I have a dataframe df with two or more columns, is there an
I have a list L of data frames with two columns each...a key, and
I have a dataframe of 9 columns consisting of an inventory of factors. Each
I have a data frame which has two columns of dates in the format
I have a data frame with two columns, and want to create a third
I have a data frame with two columns. First column contains categories such as
I have two dataframes with the same number of columns. I'm writing a function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.