Summary

This document provides an introduction to data handling using the Python Pandas library. It covers topics including Python libraries, data structures, operations, and data visualization. The content is suitable for undergraduate-level learners.

Full Transcript

**Unit 1: Data Handling using Pandas - I** **1. Python Libraries** - **Pandas**: A Python library for data manipulation and analysis. - **Matplotlib**: A library for creating static, interactive, and animated visualizations. **2. Data Structures in Pandas** - **Series**: A one-dimensi...

**Unit 1: Data Handling using Pandas - I** **1. Python Libraries** - **Pandas**: A Python library for data manipulation and analysis. - **Matplotlib**: A library for creating static, interactive, and animated visualizations. **2. Data Structures in Pandas** - **Series**: A one-dimensional labeled array capable of holding data of any type. - **DataFrame**: A two-dimensional, size-mutable, and heterogeneous tabular data structure. **3. Series** - **Creation of Series**: - From **ndarray**: pd.Series(\[1, 2, 3\]) - From **dictionary**: pd.Series({\'a\': 1, \'b\': 2}) - From **scalar value**: pd.Series(5, index=\[\'a\', \'b\', \'c\'\]) - **Operations**: Mathematical operations like addition, subtraction, multiplication, etc. - **Functions**: - **Head()**: Displays the first few elements. - **Tail()**: Displays the last few elements. - **Selection, Indexing, and Slicing**: - Indexing: Access data via index labels or positions. - Slicing: series\[start:end\]. **4. DataFrames** - **Creation of DataFrame**: - From dictionary of Series: pd.DataFrame({\'col1\': pd.Series(\[\...\])}) - From list of dictionaries: pd.DataFrame(\[{\'a\': 1, \'b\': 2}, {\'a\': 3, \'b\': 4}\]) - From CSV files: pd.read\_csv(\'file.csv\'). - **Operations**: - Add, select, delete, rename columns or rows. - **Head()** and **Tail()** functions for previewing data. - **Indexing**: - Using **labels**: df.loc\[\] - Boolean indexing: df\[df\[\'col\'\] \> value\]. - **Import/Export Data**: - Import from CSV: pd.read\_csv(\'file.csv\') - Export to CSV: df.to\_csv(\'file.csv\', index=False). **5. Data Visualization** - **Purpose of Plotting**: To analyze data visually. - **Types of Plots**: - **Line Plot**: plt.plot(x, y) - **Bar Graph**: plt.bar(x, y) - **Histogram**: plt.hist(data, bins=n). - **Customizing Plots**: - Add **labels**: plt.xlabel(\'X-axis\'), plt.ylabel(\'Y-axis\'). - Add **title**: plt.title(\'Plot Title\'). - Add **legend**: plt.legend(\[\'label1\', \'label2\'\]). - **Saving Plots**: plt.savefig(\'filename.png\'). **Unit 2: Database Query using SQL** **1. Revision of Database Concepts** - **Database**: A structured collection of data. - **SQL (Structured Query Language)**: Used to interact with databases. - Basic SQL commands from Class XI: - **DDL (Data Definition Language)**: CREATE, ALTER, DROP. - **DML (Data Manipulation Language)**: SELECT, INSERT, UPDATE, DELETE. - **TCL (Transaction Control Language)**: COMMIT, ROLLBACK. **2. Mathematical Functions** - **POWER(x, y)**: Returns xyx\^yxy. Example: SELECT POWER(2, 3); → 8 - **ROUND(x, d)**: Rounds xxx to ddd decimal places. Example: SELECT ROUND(12.345, 2); → 12.35 - **MOD(x, y)**: Returns the remainder of x/yx / yx/y. Example: SELECT MOD(10, 3); → 1 **3. Text Functions** - **UCASE() / UPPER()**: Converts text to uppercase. Example: SELECT UCASE(\'abc\'); → \'ABC\' - **LCASE() / LOWER()**: Converts text to lowercase. Example: SELECT LCASE(\'ABC\'); → \'abc\' - **MID() / SUBSTRING() / SUBSTR()**: Extracts a substring.\ Example: SELECT SUBSTRING(\'Hello\', 2, 3); → \'ell\' - **LENGTH()**: Returns the length of a string. Example: SELECT LENGTH(\'Hello\'); → 5 - **LEFT()**: Extracts left characters. Example: SELECT LEFT(\'Hello\', 2); → \'He\' - **RIGHT()**: Extracts right characters. Example: SELECT RIGHT(\'Hello\', 2); → \'lo\' - **INSTR()**: Finds the position of a substring. Example: SELECT INSTR(\'Hello\', \'l\'); → 3 - **LTRIM() / RTRIM() / TRIM()**: Removes spaces from left, right, or both sides of a string. Example: SELECT TRIM(\' abc \'); → \'abc\' **4. Date Functions** - **NOW()**: Returns the current date and time. Example: SELECT NOW(); - **DATE()**: Extracts the date from a datetime. Example: SELECT DATE(\'2024-12-12 10:15:00\'); → \'2024-12-12\' - **MONTH()**: Returns the month number. Example: SELECT MONTH(\'2024-12-12\'); → 12 - **MONTHNAME()**: Returns the name of the month. Example: SELECT MONTHNAME(\'2024-12-12\'); → \'December\' - **YEAR()**: Returns the year. Example: SELECT YEAR(\'2024-12-12\'); → 2024 - **DAY()**: Returns the day of the month. Example: SELECT DAY(\'2024-12-12\'); → 12 - **DAYNAME()**: Returns the name of the day. Example: SELECT DAYNAME(\'2024-12-12\'); → \'Thursday\' **5. Aggregate Functions** - **MAX() / MIN()**: Returns the maximum/minimum value.\ Example: SELECT MAX(salary) FROM employees; - **AVG()**: Returns the average value. Example: SELECT AVG(salary) FROM employees; - **SUM()**: Returns the sum of values. Example: SELECT SUM(salary) FROM employees; - **COUNT()**: Counts the number of rows. Example: SELECT COUNT(\*) FROM employees; **6. Querying and Manipulating Data** - **GROUP BY**: Groups rows sharing a property. Example: - **HAVING**: Filters groups. Example: - **ORDER BY**: Sorts the result. Example: **7. Working with Two Tables** - **Equi-Join**: Combines rows from two tables where a common column matches. Example: **Unit 3: Introduction to Computer Networks** **1. Introduction to Networks** - **Definition**: A network is a collection of interconnected devices that communicate with each other to share resources and information. - **Types of Networks**: - **PAN (Personal Area Network)**: Small network for personal devices, e.g., Bluetooth. - **LAN (Local Area Network)**: Covers a small geographical area like a school or office. - **MAN (Metropolitan Area Network)**: Spans a city, e.g., city-wide Wi-Fi. - **WAN (Wide Area Network)**: Covers large geographical areas, e.g., the internet. **2. Network Devices** - **Modem**: Converts digital data to analog (and vice versa) for transmission over telephone lines. - **Hub**: Broadcasts data to all devices in a network. - **Switch**: Directs data to the intended recipient using MAC addresses. - **Repeater**: Amplifies signals to extend the network range. - **Router**: Connects different networks and routes data between them. - **Gateway**: Connects networks with different protocols. **3. Network Topologies** - **Star Topology**: Devices are connected to a central hub. Easy to manage but dependent on the hub. - **Bus Topology**: Devices are connected in a linear sequence. Inexpensive but difficult to troubleshoot. - **Tree Topology**: Hierarchical combination of star and bus topologies. - **Mesh Topology**: Every device is connected to every other device. High reliability but expensive. **4. Introduction to the Internet** - **Internet**: A global network connecting millions of private, public, academic, and business networks. - **URL (Uniform Resource Locator)**: The address of a resource on the internet. - **WWW (World Wide Web)**: A system of interlinked hypertext documents accessed via the internet. **5. Applications of the Internet** - **Web**: Browsing websites for information. - **Email**: Sending and receiving electronic mail. - **Chat**: Real-time text communication. - **VoIP (Voice over Internet Protocol)**: Making voice calls over the internet. **6. Websites** - **Website**: A collection of related web pages. - **Difference Between Website and Webpage**: - **Website**: A collection of web pages (e.g., [[www.google.com]](http://www.google.com)). - **Webpage**: A single page on a website (e.g., www.google.com/maps). - **Static vs. Dynamic Webpages**: - **Static**: Content is fixed. - **Dynamic**: Content changes based on user interaction. - **Web Server**: A server that hosts websites. - **Web Hosting**: The process of storing a website on a server to make it accessible online. **7. Web Browsers** - **Definition**: Software used to access the web. Examples: Google Chrome, Mozilla Firefox. - **Browser Settings**: Customization options for user preferences. - **Add-ons and Plug-ins**: Additional tools to extend browser functionality. - **Cookies**: Small data files stored by websites on the user's computer to remember preferences. **Unit 4: Societal Impacts** **1. Digital Footprint** - **Definition**: The trail of data left behind by users while using the internet (e.g., social media posts, search history, cookies). - **Types**: - **Active**: Information shared intentionally, like posts or comments. - **Passive**: Data collected without the user's knowledge, such as location tracking. - **Impact**: Can affect privacy, security, and reputation. **2. Net and Communication Etiquettes** - **Definition**: Guidelines for respectful and responsible communication online. - **Examples**: - Avoid spamming. - Be respectful in emails and messages. - Use proper language and avoid offensive content. **3. Data Protection** - **Definition**: Safeguarding personal and sensitive data from unauthorized access. - **Methods**: - Use strong passwords. - Enable two-factor authentication. - Avoid sharing sensitive information on unsecured platforms. **4. Intellectual Property Rights (IPR)** - **Definition**: Legal rights protecting creations of the mind, like inventions, artworks, and designs. - **Components**: - **Patents**: For inventions. - **Copyright**: For literary and artistic works. - **Trademarks**: For brand identity. **5. Plagiarism** - **Definition**: Using someone else's work or ideas without proper credit. - **Impact**: Can lead to legal consequences and loss of credibility. - **Prevention**: Cite sources properly, use plagiarism detection tools. **6. Licensing and Copyright** - **Copyright**: Legal protection for creators against unauthorized use of their work. - **Licenses**: Allow others to use copyrighted material under specific terms (e.g., Creative Commons). **7. Free and Open Source Software (FOSS)** - **Definition**: Software with source code that is freely available for modification and distribution. - **Examples**: Linux, Apache, LibreOffice. - **Benefits**: Cost-effective, promotes collaboration, no vendor lock-in. **8. Cybercrime and Cyber Laws** - **Cybercrime**: Illegal activities involving computers and the internet (e.g., hacking, phishing, identity theft). - **Cyber Laws in India**: Governed by the **Indian IT Act, 2000**. Key features: - Legal recognition of digital signatures. - Prevention of cybercrime. - Penalizes hacking, data theft, and phishing. **9. Types of Cyber Threats** - **Hacking**: Gaining unauthorized access to a system. - **Phishing**: Fraudulent attempts to steal sensitive information via fake emails or websites. - **Cyber Bullying**: Harassment using digital platforms. **10. E-Waste** - **Definition**: Discarded electronic devices and components. - **Hazards**: Toxic chemicals in e-waste can harm the environment and human health. - **Management**: - Recycling and refurbishing. - Safe disposal methods. - Encouraging extended producer responsibility. **11. Health Concerns Related to Technology Usage** - **Physical Issues**: Eye strain, posture problems, carpal tunnel syndrome. - **Mental Issues**: Addiction to technology, social isolation, stress. - **Solutions**: - Follow the **20-20-20 Rule**: Every 20 minutes, look at something 20 feet away for 20 seconds. - Take regular breaks. - Use ergonomic equipment.

Use Quizgecko on...
Browser
Browser