Python Forum
How to find common names in multiple columns
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find common names in multiple columns
#1
Hi,
I have below data frame, and I want get the common values in all three columns.

1 2  3
2 5  45
5 8  4
4 0  5 
6 10 11 
9 4  0

Desired output:
2
5
4
Reply
#2
What have you tried? How is it not working?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
Set intersection?

But you need to more clearly define your input => output first. If 2 is valid output, why isn't 0? 2 isn't in all three columns, so if you want values that match at least two columns, then 0 would also match. Unless there's another criteria you haven't mentioned.
Reply
#4
(Nov-27-2018, 06:22 PM)nilamo Wrote: so if you want values that match at least two columns, then 0 would also match.

I thought it was the most common values across all three columns, but it is still the same question. Two occurs twice and so does zero.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to check multiple columns value within range SamLiu 2 1,104 Mar-13-2023, 09:32 AM
Last Post: SamLiu
  Find duplicate files in multiple directories Pavel_47 9 2,932 Dec-27-2022, 04:47 PM
Last Post: deanhystad
  Python: re.findall to find multiple instances don't work but search worked Secret 1 1,174 Aug-30-2022, 08:40 PM
Last Post: deanhystad
  How to move multiple columns to initial position SriRajesh 4 1,375 Jul-02-2022, 10:34 AM
Last Post: deanhystad
  df column aggregate and group by multiple columns SriRajesh 0 979 May-06-2022, 02:26 PM
Last Post: SriRajesh
  Split single column to multiple columns SriRajesh 1 1,290 Jan-07-2022, 06:43 PM
Last Post: jefsummers
  Apply fillna to multiple columns in dataframe rraillon 2 2,373 Aug-05-2021, 01:11 PM
Last Post: rraillon
  Find Common Elements in 2 list quest 4 2,688 Apr-14-2021, 03:57 PM
Last Post: quest
  Pandas: how to split one row of data to multiple rows and columns in Python GerardMoussendo 4 6,714 Feb-22-2021, 06:51 PM
Last Post: eddywinch82
  How to fill parameter with data from multiple columns CSV file greenpine 1 1,619 Dec-21-2020, 06:50 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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