TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #2666 7.99K
Quick Python Cheat Sheet for Beginners ๐Ÿโœ๏ธ

Python is widely used for data analysis, automation, and AIโ€”perfect for beginners starting their coding journey.

Aggregation Functions ๐Ÿ“Š

โ€ข sum(list) โ†’ Adds all values
๐Ÿ‘‰ sum([1,2,3]) = 6
โ€ข len(list) โ†’ Counts total elements
๐Ÿ‘‰ len([1,2,3]) = 3
โ€ข max(list) โ†’ Highest value
๐Ÿ‘‰ max([4,7,2]) = 7
โ€ข min(list) โ†’ Lowest value
๐Ÿ‘‰ min([4,7,2]) = 2
โ€ข sum(list)/len(list) โ†’ Average
๐Ÿ‘‰ sum([10,20])/2 = 15

Lookup / Searching ๐Ÿ”

โ€ข in โ†’ Check existence
๐Ÿ‘‰ 5 in [1,2,5] = True
โ€ข list.index(value) โ†’ Position of value
๐Ÿ‘‰ [10,20,30].index(20) = 1
โ€ข Dictionary lookup
๐Ÿ‘‰ data = {"name": "John", "age": 25} data["name"] # John

Logical Operations ๐Ÿง 

โ€ข if condition: โ†’ Decision making
๐Ÿ‘‰ if x > 10: print("High") else: print("Low")
โ€ข and โ†’ All conditions true
โ€ข or โ†’ Any condition true
โ€ข not โ†’ Reverse condition

Text (String) Functions ๐Ÿ”ค

โ€ข len(text) โ†’ Length
๐Ÿ‘‰ len("hello") = 5
โ€ข text.lower() โ†’ Lowercase
โ€ข text.upper() โ†’ Uppercase
โ€ข text.strip() โ†’ Remove spaces
๐Ÿ‘‰ " hi ".strip() = "hi"
โ€ข text.replace(old, new)
๐Ÿ‘‰ "hi".replace("h","H") = "Hi"
โ€ข String concatenation
๐Ÿ‘‰ "Hello " + "World"

Date Time Functions ๐Ÿ“…

โ€ข from datetime import datetime
โ€ข datetime.now() โ†’ Current date time
โ€ข Extract values:
now = datetime.now() now.year now.month now.day

Math Functions โž—

โ€ข import math
โ€ข math.sqrt(x) โ†’ Square root
โ€ข math.ceil(x) โ†’ Round up
โ€ข math.floor(x) โ†’ Round down
โ€ข abs(x) โ†’ Absolute value

Conditional Aggregation (Like Excel SUMIF) โšก

โ€ข Using list comprehension

nums = [10, 20, 30, 40] sum(x for x in nums if x > 20) # 70

โ€ข Count condition

len([x for x in nums if x > 20]) # 2

Pro Tip for Data Analysts ๐Ÿ’ก

๐Ÿ‘‰ For real-world work, use libraries: pandas & numpy

Example:
import pandas as pd df["salary"].mean()

Python Resources: https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L

Double Tap โ™ฅ๏ธ For More
  • โค 16
More from @sqlspecialist
  1. Oct 9, 2026โ€œHere, the data is sorted by the second column in descending order and the first five rowsโ€ฆ
  2. Oct 9, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 6 Guys, let's continue our Data Analyst Interviewโ€ฆ
  3. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  4. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  5. Oct 7, 2026๐Ÿ“Š Kandinsky 6.0 Video: AI-Powered Content Creation for Analysts The new Kandinsky 6.0 Vidโ€ฆ
  6. Oct 7, 2026Alternatively, depending on the Excel version and requirement, I could use functions suchโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’