search

Home  >  Q&A  >  body text

python - How to use mode() in pandas?

As shown in the title, how to use mode() in pandas? I didn’t understand the official introduction, as follows

>>> df = pd.DataFrame({'A': [1, 2, 1, 2, 1, 2, 3]})
>>> df.mode()
   A
0  1
1  2

http://pandas.pydata.org/pand...

大家讲道理大家讲道理2739 days ago1604

reply all(1)I'll reply

  • 阿神

    阿神2017-06-30 10:02:20

    mode should be the mode, which is the one with the highest frequency. In the example, 1 and 2 both appear three times, which are the most frequent, so these two numbers are returned.

    reply
    0
  • Cancelreply