1 Reply Latest reply on May 2, 2019 12:36 AM by Tim Beard

    Counting repetition in 2 different columns

    Juliana Almeida

      I'm trying to count repetitions in 2 different columns since they have elements in common, not having success. In Python pandas I use



      origin = tour["Origin"].value_counts()

      destination = tour["Destination"].value_counts()

      pop_cities = origin + destination

      pop_cities_bar = pop_cities.sort_values(ascending=[False]).head(5)


      print('Top 5 most popular cities')


      Any ideas?