-1

im trying some excercises using python pandas module and map and np.argmap functions with a data base . this is my code :

    import pandas as pd
    pd.set_option('max_rows', 5)
    import numpy as np
    from learntools.advanced_pandas.summary_functions_maps import *
    reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", 
    index_col=0)

and i want to find which wine has the highest points using thw map and np.argmax function but i keep on getting stuck on how to use this 2 functions thanks for the help :)

  • "keep getting stuck" is not really a good problem description that we can help with. Please show us your attempt(s). It also helps to show (a tiny part of) your dataframe, and what output you desire. – 9769953 Sep 27 '18 at 09:41

1 Answers1

0

If your question is around how to use the functions map() and np.argmax() together, then here is an example you can refer to, where each row is passed to np.argmax() function using map(). Hope that clears your question.

a = np.array([[2,1,4,5],[7,5,9,8]])

print(list(map(np.argmax,a)))

output: [3, 2]

Raj
  • 41
  • 3