Back to Browse

1# Create Frequency Distribution Table & Bar Chart | Python Program for COSM | Prof. Jasbir Singh

71 views
Aug 6, 2025
21:06

🧾 About This Video: Welcome to the COSM (Computer Oriented Statistical Methods) Playlist for BCA 5th Semester students. In this hands-on lecture, Prof. Jasbir Singh (HoD, Computer Science) walks you through a complete Python solution to the problem: “Create a frequency distribution table for ungrouped (individual/discrete) data, and visualize it using a bar chart with matplotlib.” This is part of our practical series on solving statistical methods using Python on platforms like Kaggle and Google Colab. 🔢 Video Breakdown (Timestamps) Time Section ⏱️ 0:00 Introduction to COSM Playlist & Objective of Lecture ⏱️ 1:00 What is Ungrouped Data? Understanding the Problem Statement ⏱️ 3:30 Manual Calculation: Frequency Table for Data: 1, 2, 3, 1, 4, 5, 3, 2, 1, 1 ⏱️ 6:30 Transition to Python Coding – Step-by-Step Live Explanation ⏱️ 7:00 Step 1: Input n numbers into a Python list ⏱️ 8:30 Step 2: Use collections.Counter to calculate frequency count ⏱️ 10:00 Step 3: Extract keys and values into two separate lists for display ⏱️ 11:30 Step 4: Create Frequency Table Output using print() ⏱️ 13:30 Step 5: Plot Bar Chart using matplotlib.pyplot.bar() ⏱️ 14:30 Styling the Graph: Color, Width, Edge color ⏱️ 16:00 Summary: Steps Recap + Python Concepts Used ⏱️ 17:30 Real-Life Applications of Frequency Distribution ⏱️ 18:30 Hands-on Assignment for Students – Try with Your Own Data ⏱️ 19:30 Closing Remarks + Next Video Preview (Grouped Data and Histogram) 📂 Python Concepts Covered ✅ input() – Reading user input ✅ list – Storing data ✅ for loop – Iteration over range ✅ append() – Add elements to a list ✅ collections.Counter() – Efficient frequency counting ✅ matplotlib.pyplot.bar() – Bar chart for discrete data ✅ plt.xlabel(), plt.ylabel(), plt.title() – Adding labels to the chart ✅ plt.show() – Displaying the plot 🧪 Problem Statement Write a Python program to: Input n numbers from the user Store them in a list Calculate the frequency of each element Display the frequency distribution table Plot a bar chart showing the data and their frequencies 💻 Code Used in This Video python Copy Edit import matplotlib.pyplot as plt from collections import Counter n = int(input("Enter n: ")) data = [] for i in range(n): x = int(input("Enter x: ")) data.append(x) freq = Counter(data) x = [] f = [] for i in freq: x.append(i) f.append(freq[i]) print("x f") for i in range(len(x)): print(x[i], " ", f[i]) plt.bar(freq.keys(), freq.values(), width=1.0, edgecolor='red', color='yellow') plt.title("Histogram : Indivisual series - discrete Series") plt.xlabel("Data") plt.ylabel("Frequency") plt.show() 🧠 Student Practice Task 🎯 Try this example on your own: python Copy Edit data = [7, 8, 7, 9, 10, 8, 7, 10, 9, 10, 8, 7] 👉 Create frequency table and plot a bar chart 📝 Submit your Kaggle/Colab notebook link on the LMS 📈 Applications in Real Life Student Marks Distribution Survey Responses Product Purchase Count Daily Visitors or Login Frequency Health Reports (e.g., number of visits per day) 📚 Next Video in COSM Playlist ➡️ Grouped Data: Class Intervals and Histograms ➡️ Cumulative Frequency and Ogives ➡️ Central Tendencies: Mean, Median, Mode (with Python) 🔔 Subscribe to stay updated. 🧑‍🏫 About the Instructor Prof. Jasbir Singh HoD, Department of Computer Science Secretary, Ek Mauka Ek Umeed NGO Passionate Educator in AI, ML, and Quantum Computing Expert in AI in Education & Digital Literacy for Underserved Learners 🔗 Useful Links 🔗 COSM Playlist: [Add Playlist Link Here] 🔗 Kaggle Python Starter Notebook: https://www.kaggle.com/code/jasbirsinghjarial/p1-datadistribution-cosm 🔗 Ek Mauka Ek Umeed NGO: [https://emeu.co.in] 📘 HPU BCA 5th Sem Syllabus.

Download

0 formats

No download links available.

1# Create Frequency Distribution Table & Bar Chart | Python Program for COSM | Prof. Jasbir Singh | NatokHD