Write a Pandas program to calculate the frequency counts of each unique value of a given series
- برمجة بي اتش بي
- 2021-09-10
- mhanasmh00489829403
الأجوبة
import pandas as pd
import numpy as np
num_series = pd.Series(np.take(list('0123456789'), np.random.randint(10, size=40)))
print("Original Series:")
print(num_series)
print("Frequency of each unique value of the said series.")
result = num_series.value_counts()
print(result)
Sample Output:
Original Series: 0 1 1 7 2 1 3 6 4 9 5 1 6 0 7 0 8 7 9 9 10 6 11 0 12 1 13 6 14 7 15 0 16 2 17 9 18 2 19 0 20 5 21 2 22 3 23 2 24 3 25 0 26 0 27 8 28 8 29 2 30 9 31 1 32 2 33 9 34 2 35 9 36 0 37 0 38 4 39 8 dtype: object Frequency of each unique value of the said series. 0 9 2 7 9 6 1 5 6 3 8 3 7 3 3 2 4 1 5 1 dtype: int64
القوائم الدراسية التي ينتمي لها السؤال