Data Handling with Pandas — I
Key Points to Remember
- →Pandas: Python library for data manipulation. import pandas as pd.
- →Series: 1D labelled array. pd.Series([10,20,30], index=['a','b','c']).
- →DataFrame: 2D labelled table. pd.DataFrame({'Name':['A','B'], 'Marks':[80,90]}).
- →Attributes: df.shape (rows, cols), df.dtypes, df.index, df.columns, df.size.
- →Methods: df.head(n), df.tail(n), df.info(), df.describe() (statistics for numeric columns).
- →Reading CSV: pd.read_csv('file.csv'). Saving: df.to_csv('file.csv', index=False).
- →Accessing: df['colName'] (Series), df[['col1','col2']] (DataFrame), df.loc['rowLabel'], df.iloc[rowIndex].
Exam Tips
df.describe() gives: count, mean, std, min, 25%, 50%, 75%, max for each numeric column.
loc uses labels; iloc uses integer positions — common exam question.
df.at['row','col'] for single scalar value; df.iat[row_int, col_int] for integer position scalar.
Data Handling with Pandas — II
Key Points to Remember
- →Boolean indexing: df[df['Marks'] > 80] — filter rows where condition is True.
- →Sorting: df.sort_values(by='Marks', ascending=True/False). df.sort_index(ascending=True).
- →Adding column: df['Grade'] = df['Marks'].apply(lambda x: 'A' if x>=90 else 'B').
- →Dropping: df.drop('colName', axis=1) for column; df.drop(rowLabel, axis=0) for row.
- →Groupby: df.groupby('Dept')['Salary'].mean() — average salary per department.
- →Merge: pd.merge(df1, df2, on='key', how='inner'). how options: 'inner','left','right','outer'.
- →Concatenate: pd.concat([df1, df2], axis=0) row-wise; axis=1 column-wise.
- →Handling missing: df.isnull() — boolean. df.fillna(value) — replace NaN. df.dropna() — remove rows with NaN.
Exam Tips
inner join: only matching keys. left join: all from left + matching from right.
groupby().agg({'col': ['sum','mean','count']}) for multiple aggregations.
fillna with mean: df['col'].fillna(df['col'].mean()) — common practical question.
Data Visualisation using Matplotlib
Key Points to Remember
- →import matplotlib.pyplot as plt. Always end with plt.show().
- →Line chart: plt.plot(x, y, color='red', marker='o', linestyle='--', label='Data'). Use plt.legend().
- →Bar chart: plt.bar(x, height, color='blue', width=0.5). plt.barh() for horizontal.
- →Scatter plot: plt.scatter(x, y, color='green', marker='*').
- →Pie chart: plt.pie(values, labels=labels, autopct='%1.1f%%', explode=(0.1,0,0,...)).
- →Histogram: plt.hist(data, bins=10, color='orange', edgecolor='black').
- →Formatting: plt.xlabel('X label'), plt.ylabel('Y label'), plt.title('Title'), plt.grid(True).
- →Saving: plt.savefig('chart.png') — must be called before plt.show().
Exam Tips
autopct in pie chart: '%1.1f%%' shows percentages rounded to 1 decimal.
edgecolor in bar/histogram: adds border to each bar for clarity.
Stack bar: plt.bar(x, val1, label='A'); plt.bar(x, val2, bottom=val1, label='B').
Database Management using MySQL
Key Points to Remember
- →DDL: CREATE DATABASE db; USE db; CREATE TABLE emp (eid INT PRIMARY KEY, ename VARCHAR(20), salary DECIMAL(10,2));
- →ALTER TABLE emp ADD COLUMN dept VARCHAR(20); ALTER TABLE emp MODIFY salary FLOAT; ALTER TABLE emp DROP COLUMN dept;
- →DML: INSERT INTO emp VALUES (1,'Ramesh',50000); UPDATE emp SET salary=55000 WHERE eid=1; DELETE FROM emp WHERE eid=1;
- →DQL: SELECT * FROM emp; SELECT ename, salary FROM emp WHERE salary > 40000 ORDER BY salary DESC;
- →Aggregate: SELECT dept, COUNT(*), AVG(salary), MAX(salary), MIN(salary) FROM emp GROUP BY dept HAVING AVG(salary) > 40000;
- →INNER JOIN: SELECT e.ename, d.dname FROM emp e INNER JOIN dept d ON e.dept_id = d.dept_id;
- →Constraints: PRIMARY KEY (unique, not null), FOREIGN KEY (references another table), UNIQUE, NOT NULL, DEFAULT, CHECK.
Exam Tips
WHERE filters rows before grouping; HAVING filters groups after GROUP BY.
ORDER BY default is ASC (ascending). DESC for descending.
Difference between DELETE (removes rows, table exists) and DROP (removes table entirely).
Networking and Internet
Key Points to Remember
- →Network types: LAN (building/campus, high speed, owned), MAN (city-wide), WAN (global, public/leased lines).
- →Topologies: Bus (all connected to one cable), Star (all connected to central hub/switch), Ring (circular), Mesh (every device connected to every other), Tree (hierarchical).
- →IP address: IPv4 = 32-bit (e.g. 192.168.1.1), IPv6 = 128-bit hexadecimal.
- →DNS: Domain Name System — translates domain names (google.com) to IP addresses.
- →Protocols: HTTP/HTTPS (web), FTP (file transfer), SMTP (email sending), POP3/IMAP (email receiving), TCP/IP (data transmission), UDP (fast, connectionless).
- →Cloud computing: IaaS (Virtual machines — AWS EC2), PaaS (development platform — Google App Engine), SaaS (applications — Gmail, Dropbox).
- →Cybersecurity: firewall, encryption, digital signature, VPN, antivirus, two-factor authentication.
Exam Tips
Bus: cheap but single point of failure. Star: most common, easy to manage. Ring: token-based, slower.
HTTP vs HTTPS: HTTPS = HTTP + SSL/TLS encryption.
MAC address: physical address of network card — 48-bit hexadecimal, unchangeable.
Emerging Trends
Key Points to Remember
- →AI: simulation of human intelligence — speech recognition, image recognition, decision making. Types: Narrow AI (current), General AI (hypothetical), Super AI (future).
- →Machine Learning: systems learn from data. Types: Supervised (labelled data, classification/regression), Unsupervised (unlabelled, clustering), Reinforcement (reward-based).
- →Deep Learning: neural networks with many layers. Used in image recognition, NLP.
- →IoT (Internet of Things): physical devices embedded with sensors connected to internet. Examples: smart thermostat, fitness bands, smart traffic lights.
- →Big Data: 3Vs — Volume (huge size), Velocity (generated fast), Variety (structured/unstructured/semi-structured).
- →Blockchain: distributed ledger. Each block = data + hash + previous block's hash. Decentralised, tamper-resistant. Used in cryptocurrency, supply chain.
- →5G: 5th generation mobile network. Speed up to 20 Gbps. Low latency. Enables IoT at scale, autonomous vehicles.
Exam Tips
AI application examples: Siri, Alexa (voice recognition), self-driving cars, medical diagnosis.
Blockchain: once added, a block cannot be changed without changing all subsequent blocks — immutable.
Big Data tools: Hadoop for storage, MapReduce for processing.
Societal Impacts of IT
Key Points to Remember
- →Digital footprint: data trail left by online activities. Active (deliberate — posts, emails) vs Passive (unintentional — browsing history, cookies).
- →Cyber crimes: phishing (fake emails to steal credentials), vishing (voice phishing), smishing (SMS phishing), identity theft, cyberbullying, cyberstalking.
- →Safe practices: strong passwords (uppercase + lowercase + numbers + symbols, 8+ chars), 2FA, regular software updates, avoid public Wi-Fi, verify sender before clicking links.
- →E-waste: discarded electronics. Contains toxic materials (lead, mercury, cadmium). Should be sent to certified recyclers. Growing concern.
- →Intellectual property: copyright (creative works), patents (inventions), trademarks (brand identity). Plagiarism is academic dishonesty.
- →Gender and disability: technology should be accessible. Screen readers for visually impaired, voice recognition for motor impaired. Gender gap in tech employment.
Exam Tips
Distinguish active vs passive digital footprint with examples.
Phishing email signs: urgent language, spelling errors, suspicious sender address, requests for personal info.
IT Act 2000 (India): governs cybercrime. Sec 43 (damage to computer), Sec 66 (hacking), Sec 67 (obscene content online).