• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Pandas Number of Unique Values from 2 Fields

Resolved: Pandas Number of Unique Values from 2 Fields

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am trying to find the number of unique values that cover 2 fields. So for example, a typical example would be last name and first name. I have a data frame.
enter image description here
When I do the following, I just get the number of unique fields for each column, in this case, Last and First. Not a composite.
Thanks!

Answer:

Groupby both columns first, and then use nunique

If you have better answer, please add a comment about this, thank you!

pandas python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Unable to run Docker .NET 6 console image

02/04/2023

Resolved: Input Focus between two React Components

02/04/2023

Resolved: linq2db throws exception when filtering by nested collection

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.