Coders Packet

Frequency Distribution Table using Python

By Ayush Chauhan

Create a frequency distribution table of class interval of size 5, containing upper limit, lower limit, frequency and middle values of limits using numpy and pandas libraries in python.

Frequency Distribution Table

These are some steps/logics the were followed in the code (python programming language):

Step 1:

Create a list for lower limit, upper limit and frequency of the respective class intervals, name them ll, ul and freq respectively.

Step 2:

Now, create a 2D array consisting of lower limit, upper limit and the respective frequencies of the observations using numpy.

Step 3:

The middle value is the average of upper and lower limit.

Step 4:

Create a data frame which has upper limit, lower limit, frequency and middle value as the columns.

Step 5:

The data in the data frame represents the values i.e. the upper limit, frequencies, and middle values.

Step 6:

The frequency distribution table can be used for computation of the data such as finding mean, median and mode.

Step 7:

Lastly the mean of the data was found by taking the product of the corresponding frequency and middle value, summing them up and dividing it by the sum of frequencies.

Download Complete Code


No comments yet