0% found this document useful (0 votes)
4 views2 pages

Python SQL Summary and Questions

The document covers data handling using the Pandas library in Python, detailing its key structures like Series and DataFrame, and methods for data manipulation. It also discusses data visualization techniques using Matplotlib, including various chart types and their syntax. Lastly, it introduces SQL for database querying, explaining essential functions and clauses such as ORDER BY, aggregate functions, and GROUP BY.

Uploaded by

masifakrami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python SQL Summary and Questions

The document covers data handling using the Pandas library in Python, detailing its key structures like Series and DataFrame, and methods for data manipulation. It also discusses data visualization techniques using Matplotlib, including various chart types and their syntax. Lastly, it introduces SQL for database querying, explaining essential functions and clauses such as ORDER BY, aggregate functions, and GROUP BY.

Uploaded by

masifakrami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Data Handling, Visualization & SQL

Summary

1. Data Handling Using Pandas – I


Pandas is a Python library used for data analysis and manipulation. It provides two main data
structures: 1. Series – 1D labeled array (like a column) 2. DataFrame – 2D labeled table (like Excel)
Key Concepts:
• Series: One-dimensional, labeled, holds any data type. Created using pd.Series(data, index=...).
• DataFrame: Two-dimensional table, created from Series, lists, dictionaries, or NumPy arrays.
• Access data using loc[], iloc[], or slicing like df[2:5].
• Boolean Indexing selects rows based on conditions.
• Merging, joining, and concatenation combine data.
• CSV file handling: pd.read_csv() and df.to_csv() for import/export.
Important Questions:
– Define Pandas and its data structures.
– What is the difference between Series and DataFrame?
– Explain loc(), iloc(), and slicing in Pandas.
– What is Boolean indexing? Give example.
– Explain different join types in Pandas.
– How do you read and write CSV files in Pandas?

2. Data Visualization
Data visualization represents data in graphical form for better understanding. Python uses the
Matplotlib library for visualization, mainly its submodule Pyplot.
• Line Graph: plt.plot(x, y, color, linewidth, linestyle) – shows trends.
• Bar Graph: plt.bar(x, y) – compares categories; plt.barh() for horizontal bars.
• Pie Chart: plt.pie(values, labels, colors, explode, autopct, shadow).
• Histogram: plt.hist(data, bins, rwidth, edgecolor) – shows distribution.
• Box Plot: plt.boxplot(data) – shows median, quartiles, and outliers.
• Scatter Plot: plt.scatter(x, y, color, marker) – shows relation between variables.
• Save Plot: plt.savefig('filename.png').
Important Questions:
– What is data visualization?
– Explain line, bar, and pie charts with syntax.
– What is the difference between bar graph and histogram?
– Define IQR and explain box plot components.
– Explain scatter plot with marker examples.
– How to save a plot in Matplotlib?

3. Database Query Using SQL


SQL (Structured Query Language) is used to manage and query data in relational databases.
• Sorting: ORDER BY clause – SELECT * FROM emp ORDER BY salary DESC;
• Aggregate Functions: SUM(), AVG(), COUNT(), MAX(), MIN() – perform calculations on data.
• GROUP BY: Groups rows and applies aggregate functions on each group.
• HAVING: Filters groups formed by GROUP BY clause.
• String Functions: LOWER(), UPPER(), TRIM(), CONCAT(), LENGTH().
• Math Functions: ROUND(), POWER(), SQRT(), MOD().
• Date & Time Functions: CURDATE(), NOW(), DAYNAME(), MONTH(), YEAR().
Important Questions:
– What is ORDER BY clause? Give example.
– List and explain aggregate functions in SQL.
– Difference between COUNT(*) and COUNT(column).
– Explain GROUP BY with example.
– What is the purpose of HAVING clause?
– List 5 string, 5 math, and 5 date/time functions with examples.

You might also like