Data Visualisation and Analytics Lab — Free Notes & Tutorial
Free DVA Lab practicals for BCA — visualization programs and analytics exercises at SikshaSarovar. Free DVA Lab course on SikshaSarovar.
This Data Visualisation and Analytics Lab course is part of Siksha Sarovar and is 100% free for students in India — no sign-up required to read. It contains 15 structured lessons with examples, and pairs with our free online compiler and AI tutor.
What you will learn
- Visualization programs
- Analytics lab exercises
Course content (15 lessons)
- Practical 1: DataFrame Selection with loc() and iloc() — Aim To create a pandas DataFrame containing e-commerce order data and perform row and column selection using the label-based indexer loc[] and the position-based indexer iloc[] .…
- Practical 2: Series Square and Filter — Aim To create a pandas Series object s5 containing numbers, compute the square of every element into a second Series s6 using vectorised arithmetic, and display only the squared…
- Practical 3: Fill Missing Values with Zero — Aim To locate missing values ( NaN ) in a student records DataFrame and replace them with zero using fillna(0) , while learning when zero-imputation is legitimate and when it…
- Practical 4: Combine DataFrames using concat(), join(), merge() — Aim To combine related DataFrames using the three pandas combination tools — concat() , join() and merge() — and to understand which tool answers which analytical question. CO…
- Practical 5: Bar Graph for CWG-2018 Medal Tally — Aim To draw a bar graph of India's CWG-2018 medal tally (Gold 26, Silver 20, Bronze 20, Total 66) with matplotlib and to read it using sound perceptual principles. CO Mapping:…
- Practical 6: Seaborn Line, Dist, Lm, and Count Plot — Aim To produce four seaborn statistical plots — line plot, distribution plot (histogram + KDE), regression plot ( lmplot ) and count plot — from one study-habits dataset, and to…
- Practical 7: NGO Aid DataFrame Filtering — Aim To create a DataFrame aid storing aid (toys, books, uniforms, shoes) sent by NGOs to different states, and to display (a) Books and Uniforms only and (b) Shoes only, using…
- Practical 8: Pivot - Projects by Position and City — Aim To create a DataFrame ndf with Name, Gender, Position, City, Age and Projects, and to summarise the total projects handled by each Position for each City using pd.pivot…
- Practical 9: Line Chart for 10 Unit Test Marks — Aim To store a student's marks in 10 unit tests in a list marks and plot them as a line chart with plt.plot() , using markers, axis labels and a grid so the trend across tests is…
- Practical 10: Horizontal Bar Chart for Heights — Aim To plot a horizontal bar chart of five students' heights using plt.barh() , with student names on the y-axis and height in centimetres on the x-axis. CO Mapping: CO1, CO2, CO3…
- Practical 11: One-Way ANOVA Implementation — Aim To implement one-way ANOVA (Analysis of Variance) manually with NumPy — computing the sums of squares (SS), degrees of freedom, mean squares (MS) and the F-statistic for three…
- Practical 12: Correlation Between Random Numbers — Aim To generate two related random number series with NumPy (Y built as roughly 0.7 × X plus noise), place them in a DataFrame, and measure their linear relationship with the…
- Practical 13: Covariance Implementation — Aim To implement covariance between two variables X and Y using np.cov() with ddof=1 (sample covariance), display the full 2 × 2 covariance matrix, and extract the covariance…
- Practical 14: GUI-Based Admission Form — Aim To create a GUI-based college admission form using tkinter — Labels and Entry widgets arranged with the grid() geometry manager and a Submit Button wired to a callback — that…
- Practical 15: GUI Form Connected to Database with Insert Query — Aim To connect the Practical 14 admission form to a database: on Submit the Name, Email and Course are inserted into an SQLite table via sqlite3 using a parameterised INSERT…
Practical 1: DataFrame Selection with loc() and iloc()
Aim
To create a pandas DataFrame containing e-commerce order data and perform row and column selection using the label-based indexer loc[] and the position-based indexer iloc[].
CO Mapping: CO1, CO2, CO3
Theory
A DataFrame is a two-dimensional, size-mutable, labelled data structure — conceptually a dictionary of Series that share a common row index. Every cell is therefore addressable in two independent ways:
loc[rows, cols]— label-based selection. Rows are chosen by their index labels and columns by their names. Slices are inclusive of both endpoints (loc[1:3]returns labels 1, 2 and 3), because labels have no natural "one past the end".iloc[rows, cols]— integer-position selection. Rows and columns are chosen by 0-based positions, and slices follow normal Python half-open semantics (iloc[0:3]returns positions 0, 1, 2 only).
This distinction is the single most common source of off-by-one bugs in analytics code. It matters even more after operations such as sort_values(), dropna() or boolean filtering, which leave "holes" in the index: loc[5] then means the row labelled 5, wherever it now sits, while iloc[5] means the sixth physical row. Subsetting is the pandas equivalent of SQL's SELECT ... WHERE ... and is the first step of virtually every analysis, so fluency here pays off in every later practical.
Dataset
The student creates this 5-row order table (built in the snippet as the ecommerce DataFrame with a default RangeIndex 0–4):
| Index | OrderID | Customer | Category | Sales |
|---|---|---|---|---|
| 0 | 101 | Aman | Electronics | 25000 |
| 1 | 102 | Riya | Books | 1200 |
| 2 | 103 | Kabir | Fashion | 3400 |
| 3 | 104 | Sneha | Electronics | 18000 |
| 4 | 105 | Vikas | Books | 800 |
Procedure
- Import pandas as
pd. - Build the
ecommerceDataFrame from a column dictionary; pandas assigns the default integer index 0–4. - Print the full DataFrame and confirm the index labels equal the positions (they coincide here, which is exactly why both indexers must be tested consciously).
- Run
ecommerce.loc[1:3, ["OrderID", "Category", "Sales"]]— a label slice plus an explicit column list. - Run
ecommerce.iloc[0:3, 0:3]— a position slice on both axes. - Count the rows returned by each call and note which endpoint was included.
- (Extension) Execute
ecommerce.sort_values("Sales").loc[1:3]and the same withilocto see the two indexers diverge once row order changes.
Interpretation of Results
loc[1:3] returns three rows (labels 1, 2, 3 → orders
Continue reading: Practical 1: DataFrame Selection with loc() and iloc() →
Frequently asked questions
Is the Data Visualisation and Analytics Lab course really free?
Yes. The entire Data Visualisation and Analytics Lab course on Siksha Sarovar is free to read with no account required. You can optionally sign in with Google to save your progress.
Do I get a certificate for Data Visualisation and Analytics Lab?
Yes — finish the lessons and pass the quiz to earn a free, verifiable certificate you can share on LinkedIn or with recruiters.
Can I run code while learning?
Yes. The built-in online compiler runs C, C++, Python, Java, PHP, JavaScript, C# and SQL directly in your browser — no installation needed.