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

Topper Style Notes

The document provides an overview of Python basics, including data types, list slicing, dictionaries, and DataFrame attributes. It also covers database management concepts such as keys, data types in MySQL, data constraints, SQL commands, and networking fundamentals including topologies and devices. Additionally, it touches on intellectual property, cyber crime, and website concepts.

Uploaded by

mahekmadhan789
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 views5 pages

Topper Style Notes

The document provides an overview of Python basics, including data types, list slicing, dictionaries, and DataFrame attributes. It also covers database management concepts such as keys, data types in MySQL, data constraints, SQL commands, and networking fundamentals including topologies and devices. Additionally, it touches on intellectual property, cyber crime, and website concepts.

Uploaded by

mahekmadhan789
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
You are on page 1/ 5

Topper-Style Notes

Python
Basics of Python

 Data Types:
o Integer: Whole numbers, e.g., 1, 2, 3.
o Float: Decimal numbers, e.g., 1.5, 2.75.
o String: Sequence of characters, e.g., "hello".
o Boolean: Represents True or False values.
o Mutable: Data types that can be modified after creation, such as Lists and
Dictionaries.
o Immutable: Data types that cannot be modified after creation, such as Tuples and
Strings.
 List Slicing and Replication:
o Slicing: Used to extract parts of a list using the syntax list[start:stop:step].
Example: list[1:5:2].
o Replication: Duplicates the list elements using list * n. Example: [1, 2, 3]
* 2 results in [1, 2, 3, 1, 2, 3].
 Dictionaries:
o A collection of key-value pairs defined using curly braces {}. Example: {'name':
'John', 'age': 30}.
o Access values by key: dict['name'] returns 'John'.
 For Loop:
o Iterates over a sequence (like a list, tuple, or string). Example:
o for i in range(5):
print(i)

This prints numbers from 0 to 4.

DataFrames and Its Attributes

 Attributes:
o shape: Returns a tuple (number of rows, number of columns).
o size: Total number of elements (rows * columns).
o columns: Lists all column labels.
o index: Lists all row labels.
o dtypes: Data types of each column.
 Manipulating DataFrames:
o Adding Rows/Columns: Add a new column using df['new_col'] = values.
o Removing Rows/Columns: Remove using df.drop(labels, axis) where axis
is 0 for rows and 1 for columns.
o Renaming Columns: Use df.rename(columns={'old_name': 'new_name'}).
o loc and iloc:
 loc: Access rows/columns using labels. Example: df.loc[1,
'column'].
 iloc: Access rows/columns using integer positions. Example:
df.iloc[0, 1].
o Boolean Indexing: Filter DataFrame rows based on conditions. Example:
df[df['age'] > 30].

Slice vs DataFrame

 Slice: A subset of the DataFrame that reflects changes in the original DataFrame.
 DataFrame: A standalone object that can be modified independently.

CSV Operations

 to_csv(): Exports DataFrame to a CSV file. Syntax: df.to_csv('filename.csv').


 read_csv(): Imports a CSV file into a DataFrame. Syntax:
pd.read_csv('filename.csv').
 Basics of CSV:
o CSV stands for Comma Separated Values.
o The default separator is a comma ,, but it can be customized using the sep
parameter.

DBMS and SQL


Keys

 Primary Key: A unique identifier for each record in a table. It cannot have NULL
values.
 Foreign Key: A field in a table that links to the primary key of another table, ensuring
referential integrity.
 Candidate Key: A set of fields that uniquely identify a record. One candidate key is
chosen as the primary key.

DataTypes of MySQL

 String: Used for text data.


o CHAR: Fixed length.
o VARCHAR: Variable length.
o TEXT: Large text data.
 Numeric:
o INT: Integer numbers.
o FLOAT: Floating-point numbers.
o DOUBLE: Double-precision floating-point numbers.
 Date/Time:
o DATE: Stores date in YYYY-MM-DD format.
o TIME: Stores time in HH:MM:SS format.
o DATETIME: Combines date and time.
o TIMESTAMP: Stores date and time, automatically updated.

Data Constraints

 Unique: Ensures all values in a column are distinct.


 NOT NULL: Prevents NULL values in a column.
 Default: Assigns a default value to a column if no value is provided.

RDBMS Terminologies

 Tuple: A single row in a table.


 Attribute: A column in a table.
 Relation: Another term for a table.
 Degree: The number of attributes (columns) in a table.
 Cardinality: The number of tuples (rows) in a table.

SQL Commands

 DML (Data Manipulation Language):


o INSERT: Adds new records to a table.
o UPDATE: Modifies existing records in a table.
o DELETE: Removes records from a table.
 DCL (Data Control Language):
o GRANT: Provides specific privileges to users.
o REVOKE: Removes user privileges.
 WHERE vs HAVING:
o WHERE: Filters records before grouping.
o HAVING: Filters groups after aggregation.

Functions in SQL

 String Functions:
o CONCAT(): Combines two or more strings.
o LENGTH(): Returns the length of a string.
o SUBSTR(): Extracts a substring from a string.
 ROUND(): Rounds a number to a specified number of decimal places.
 Aggregate Functions:
o SUM(): Calculates the sum of a set of values.
o AVG(): Calculates the average value.
o MAX(): Finds the maximum value.
o MIN(): Finds the minimum value.
o COUNT(): Counts the number of rows.
 Date and Time Functions:
o NOW(): Returns the current date and time.
o CURDATE(): Returns the current date.
o YEAR(), MONTH(): Extracts the year or month from a date.
 ORDER BY: Sorts the result set in ascending or descending order.
 GROUP BY: Groups rows that have the same values in specified columns.

Networking and Internet


Favourite Topology

 Star Topology:
o Features a central hub or switch to which all devices are connected.
o Easy to manage and troubleshoot.
o Real-life example: Home networks where all devices connect to a central router.

Networking Devices

 Hub vs Switch:
o Hub: Broadcasts data to all devices in the network.
o Switch: Directs data to the specific device based on MAC address, more efficient
than a hub.
 Router: Connects different networks and directs data packets to their destination.
Commonly used in homes and offices for internet access.
 Repeater: Amplifies and retransmits signals to extend the range of a network.
 Modem: Converts digital signals from a computer to analog for telephone lines and vice
versa.

LAN, MAN, WAN

 LAN (Local Area Network): Covers a small geographic area like an office or home.
 MAN (Metropolitan Area Network): Covers a larger area such as a city.
 WAN (Wide Area Network): Covers large geographical areas, often consisting of
multiple LANs. The internet is the largest WAN.

Hacking vs Cracking

 Hacking: Involves identifying weaknesses in systems to improve security. Ethical


hackers work to secure systems.
 Cracking: Malicious activity aimed at unauthorized access to systems, often for data
theft or disruption.

Intellectual Property

 Trademark: Protects brand names, logos, and slogans.


 Patent: Protects inventions, granting exclusive rights to the inventor.
 Copyright: Protects creative works like books, music, software, and films.

Cyber Crime

 Refers to criminal activities carried out using computers and the internet. Examples
include identity theft, phishing, and ransomware attacks.

Website Concepts

 Website: A collection of related web pages hosted on a web server.


 Web Server: A computer system that hosts websites and serves web pages to users.
 Web Page: A single document on the web, usually part of a website.

Full Forms

 URL: Uniform Resource Locator


 HTTP: Hypertext Transfer Protocol
 HTTPS: Secure Hypertext Transfer Protocol
 FTP: File Transfer Protocol
 WWW: World Wide Web
 Email: Electronic Mail
 Cc: Carbon Copy
 Bcc: Blind Carbon Copy
 VoIP: Voice over Internet Protocol

You might also like