I used to think python was hard for analysis until I started paying attention instead of copy and paste from AI. For example: If you know Excel referencing, you already understand Python's iloc. Here's the connection nobody tells you: Excel cell references = Python iloc positions Excel: When you write "=A1", you're saying "get the value in column A, row 1." "=B5:D10" means "get everything from column B row 5 to column D row 10." Python iloc: "df.iloc[0, 0]" means "get row 0, column 0" (same as A1 in Excel) "df.iloc[4:10, 1:4]" means "get rows 5-10, columns 2-4" (similar to B5:D10) Quick comparison: Excel: `=SUM(C2:C100)` → Sum values in column C from row 2 to 100 Python: `df.iloc[1:100, 2].sum()` → Sum values in 3rd column from row 2 to 100 The logic is the same. The language is different. Pro tip: Excel is 1-indexed (starts at 1). Python is 0-indexed (starts at 0). Excel's A1 = Python's [0, 0] Once you get this, moving between Excel and Python becomes way easier. Learning Python doesn't mean forgetting Excel. It means expanding your toolkit. What is your thoughts with python? Are you finding it difficult to learn? #Python #Excel #DataAnalytics #DataScience #DataAnalyst #PythonProgramming #ExcelTips #Pandas #LearningToCode #DataSkills #TechTransition #Analytics
Excel to Python: Understanding iloc Positions
More Relevant Posts
-
PYTHON JOURNEY - Day 46 / 50..!! TOPIC – Python Modules Today I explored Modules — a way to organize code into separate files and use pre-written code from Python’s massive library. It’s like having a giant toolbox where you only pick the tools you need! 1. Importing Built-in Modules Python comes with many "batteries included" modules. To use them, we simply use the import keyword. Python import math print(math.sqrt(64)) # Output: 8.0 print(math.pi) # Output: 3.14159... 2. Using the random Module Perfect for games or selecting random data. Python import random options = ["Rock", "Paper", "Scissors"] print(random.choice(options)) # Picks a random item print(random.randint(1, 10)) # Random number between 1 and 10 3. Using alias and from You can give a module a nickname or import only a specific part of it to save memory. Python import datetime as dt from math import factorial print(dt.datetime.now()) print(factorial(5)) # Output: 120 Why Use Modules? Efficiency: Don't reinvent the wheel! Use proven code written by experts. Organization: Keep your project files clean by separating logic. Power: Modules allow Python to do everything from web scraping to Data Science and AI. Mini Task Write a program that: Imports the random module. Creates a list called players = ["Alice", "Bob", "Charlie", "David"]. Uses random.choice() to pick a random "Winner" from the list. Prints: "And the winner is... <name>! #Python #PythonLearning #50DaysOfPython #DailyCoding #LearnPython #CodingJourney #PythonForBeginners #LinkedInLearning #DeveloperCommunity
To view or add a comment, sign in
-
-
PYTHON JOURNEY - Day 38 / 50..!! TOPIC – Python Sets Today I explored Sets — a unique data collection type in Python that is all about uniqueness and mathematical operations! 1. Creating a Set Sets use curly braces {} just like dictionaries, but they only contain single values, not pairs. Python numbers = {1, 2, 3, 4, 5, 5, 5} print(numbers) # Output: {1, 2, 3, 4, 5} (Duplicates are automatically removed!) 2. Unordered & Unindexed Unlike lists, sets do not have a fixed order. You cannot access items using an index like [0]. Python fruits = {"Apple", "Banana", "Cherry"} # print(fruits[0]) # This will cause an ERROR 3. Set Operations (The Power of Math) Python sets allow you to perform powerful operations like Union and Intersection. Python set1 = {1, 2, 3} set2 = {3, 4, 5} print(set1.union(set2)) # Output: {1, 2, 3, 4, 5} (Combines both) print(set1.intersection(set2)) # Output: {3} (Items present in both) Why Use Sets? Remove Duplicates: The easiest way to clean a list of repeating items is to convert it to a set. Membership Testing: Checking if an item exists in a set is much faster than in a list. Data Comparison: Perfect for finding what two groups of data have in common (or what makes them different). Mini Task Write a program that: Creates a list with duplicate numbers: [1, 2, 2, 3, 4, 4, 5]. Converts that list into a Set to automatically remove the duplicates. Creates a second set {4, 5, 6, 7} and prints the Intersection between the two sets. #Python #PythonLearning #50DaysOfPython #DailyCoding #LearnPython #CodingJourney #PythonForBeginners #LinkedInLearning #DeveloperCommunity
To view or add a comment, sign in
-
-
🐍 Python in 60 Seconds — Day 7 Numbers & Numeric Operations Python supports numbers naturally — no setup, no libraries. 🔢 Numeric types you’ll use most a = 10 → int b = 3.5 → float c = 2 + 3j → complex Most of the time, you’ll work with int and float. ➕ Basic math works as expected 5 + 2 → 7 5 - 2 → 3 5 * 2 → 10 But division has a twist 👇 ⚠️ Division surprise 5 / 2 → 2.5 Python always returns a float when dividing. You can even check it: type(5 / 2) → float If you want an integer result: 5 // 2 → 2 (floor division) 🔢 Remainder (very important) 5 % 2 → 1 Used in: • checking even / odd • cycles • conditions 🔺 Power 2 ** 3 → 8 🧠 Order matters (PEMDAS) 2 + 3 * 4 → 14 (2 + 3) * 4 → 20 Parentheses always win. 🔄 Mixing ints & floats 5 + 2.0 → 7.0 Python upgrades automatically. ⚠️ Beginner trap 0.1 + 0.2 → 0.30000000000000004 This is not a bug — it’s how computers store decimals. 🔙 Variables act like numbers Once a value is stored, Python treats the variable exactly like the number itself. x = 5 y = 3 z = x + y print(z) → 8 Python replaces x and y with their values, then performs the calculation. 🖨 Math inside print() You don’t need variables for every operation. You can do math directly inside print(): print(3 + 7) → 10 ⚠️ Important reminder about + The + operator depends on the data type: • With numbers → addition • With strings → joining Same symbol. Different meaning. 🔜There are more adbanced mathematical operations but they require an external library and it will be covered later. 💡 Insight Python is simple with numbers, but computers are not math professors — they’re approximators. 🔮 Next Strings and string operations — where text becomes powerful 😏🐍 #Python #LearnPython #Programming #Coding #TechCareers #DataScience #100DaysOfCode
To view or add a comment, sign in
-
-
🐍 Python in 60 Seconds — Day 5 User Input & Typecasting This is where Python starts talking back to you 😄 🧑💻 Getting input from the user name = input("Enter your name: ") Let’s say the user types: World print("Hello", name) → Hello, World ⚠️ Important rule (memorise this) input() always returns a string even if numeric data is inputed . Example: x = input("Enter a number: ") print(x + x) Input: 5 Output: 55 ❗ Why? Because "5" + "5" is text joining, not math. 🔄 Typecasting (telling Python what you mean) Typecasting means converting one data type into another. To turn user input into numbers: age = int(input("Enter your age: ")) height = float(input("Enter your height: ")) Now Python knows these are numbers, not text. ➕ Now Python can do math print(age + 1) ✅ This works Because age is an int, not a string. ❌ Common beginner mistake age = input("Enter your age: ") print(age + 1) → Error 🚫 Python won’t guess what you want. You must be explicit. 💡 Insight Python is flexible — but not psychic 🧠 You decide what a value means. Consistency beats motivation. Next: Typecasting in depth #Python #LearnPython #Programming #Coding #TechCareers #DataScience #10DaysOfCode
To view or add a comment, sign in
-
-
Python with Machine Learning — Chapter 2 📘 Topic: Python Data Types 🔍 Let's keep building your foundation. Data types tell Python what kind of value you're working with. Mastering them helps you avoid bugs and write cleaner code. Here are 5 essential types we'll use in ML: 1. Integer — whole numbers → counts, indices, labels 2. Float — decimal numbers → prices, measurements, probabilities 3. String — text → names, messages, file paths 4. Boolean — True or False → conditions, decisions 5. None → missing values or placeholders [CODE] # Integers and Floats age = 25 pi = 3.14 # Strings name = "Alice" # Boolean is_active = True # None missing_value = None print(age, pi, name, is_active, missing_value) [/CODE] Methods and functions • String methods: name.lower(), name.upper(), name.strip() • Type conversion: int(), float(), str(), bool() Quick tips • Use type() to check a variable's type • Start simple and build confidence with small experiments You're doing great. Keep practicing. Next up: Lists
To view or add a comment, sign in
-
🚀 Day-9 — Sets in Python Sets are a powerful built-in data structure in Python used to store unique elements. They are especially useful when duplicate values must be automatically removed. 🔹 What is a Set? A set is a collection of items that is: ✔ Unordered ✔ Unindexed ✔ Mutable (can be changed) ✔ Stores only unique values Sets are defined using curly braces { }. 📝 Example: numbers = {1, 2, 3, 4, 4, 5} print(numbers) 📌 Output: {1, 2, 3, 4, 5} 🔹 Important Characteristics Duplicates are automatically removed No indexing or slicing (because sets are unordered) Elements must be immutable (int, str, tuple allowed; list not allowed) 🔹 Creating a Set set1 = {10, 20, 30} set2 = set([1, 2, 3, 4]) print(set1) print(set2) ⚠ Empty set: empty_set = set() # Correct empty_set = {} # ❌ This creates a dictionary 🔥 Adding & Removing Elements fruits = {"apple", "banana"} fruits.add("cherry") fruits.remove("banana") print(fruits) Other useful methods: discard() → removes element without error pop() → removes random element clear() → removes all elements 🔹 Set Operations Set operations are very useful for comparisons. ▶ Union a = {1, 2, 3} b = {3, 4, 5} print(a | b) ▶ Intersection print(a & b) ▶ Difference print(a - b) ▶ Symmetric Difference print(a ^ b) 🔹 Looping Through a Set for item in a: print(item) ⚠ Order is not guaranteed. ⚠ Common Beginner Mistakes ❌ Trying to access set elements using index ❌ Expecting order to remain same ❌ Confusing {} as empty set ❌ Adding mutable elements like lists 🌱 Best Practices Use sets when uniqueness matters Use set operations for fast comparisons Avoid relying on order of elements Sets are extremely efficient for handling unique values and comparisons. Once mastered, they simplify logic that would otherwise need complex loops. #Python #PythonProgramming #CodingJourney #LearnTogether #CodeDaily #ProgrammingBasics #TechCommunity
To view or add a comment, sign in
-
🛠️ Scraping Data from Wikipedia Using Python Today, I worked on a simple but powerful task: extracting structured data from Wikipedia using Python. With the right approach, Wikipedia becomes a rich data source for: 📊 analysis 📈 visualization 🤖 machine learning practice Using Python libraries like: Requests – to fetch the webpage BeautifulSoup – to parse HTML tables Pandas – to clean and structure the data I was able to convert raw web content into a clean, analysis-ready dataset. This is a reminder that: Data is everywhere — the real skill is knowing how to collect it responsibly and transform it into insight. Web scraping is not about copying data. It’s about automating data collection, ensuring accuracy, and saving time. If you’re learning data analytics or Python, projects like this sharpen: ✔️ data wrangling skills ✔️ automation thinking ✔️ real-world problem solving On to the next dataset 🚀 #Python #WebScraping #DataAnalytics #BeautifulSoup #Pandas #DataEngineering #LearningInPublic #TechSkills
To view or add a comment, sign in
-
📁 How Python Handles Files Behind the Scenes A Clean Breakdown When Python works with data, it often needs to interact with files logs, configs, text docs, datasets, reports… everything lives in a file somewhere. And Python gives us a simple, elegant way to manage all of it. Here’s a crisp, easy-to-follow guide 👇 🔹 Opening the Door (Opening a File) file = open("notes.txt", "r") Modes like r, w, a, x tell Python what you want to do. 🔹 Checking What’s Inside (Reading) content = file.read() This pulls the entire content into your program. 🔹 Writing New Information file = open("notes.txt", "w") file.write("Writing into the file...") Perfect when you want to replace old content. 🔹 Adding More Data Without Erasing Anything file = open("notes.txt", "a") file.write("\nNew entry added.") 🔹 Closing the Door (Always Important!) file.close() ✨ The Smart Way — Using with with open("notes.txt", "r") as file: data = file.read() Automatically opens and closes — clean and safe. 📌 Quick Reference — Modes "r" → read "w" → write "a" → append "x" → create new "b" → binary "t" → text 💡 Why This Matters Efficient file handling is a core skill — it makes automation smoother and your code more reliable across real projects. 📘 Document Credits: Respect to the original author: PyCode Hubb Found this useful? Repost to help others learn 🔁 Follow Sumaiya for more Python, Data Engineering & coding insights! #python #filehandling #pythonprogramming #codingtips #automation #datascience #dataengineering #backenddevelopment #learnpython #developers #codebetter
To view or add a comment, sign in
-
Hey Folks , Python Looping Confusion? range(), len() & enumerate() Explained (Interview Gold) Many Python learners ask this question 👇 ❓ “Can we loop using only range() without len()?” ❌ Using range() directly on a list (WRONG) data = ["A", "B", "C"] for i in range(data): print(i) ❌ This throws an error because: 👉 range() expects a number 👉 data is a list, not an integer ✅ Why len() is used with range() for i in range(len(data)): print(i, data[i]) ✔ len(data) → gives total number of elements ✔ range(len(data)) → generates valid index positions ✔ data[i] → fetches value using index 📌 Works, but not the best practice. ⚠️ Why this approach is NOT recommended More code Manual index handling Less readable Error-prone if list size changes That’s why Python gives us something better 👇 ✅ Best & Pythonic Way: enumerate() for i, value in enumerate(data): print(i, value) ✔ No len() ✔ No manual indexing ✔ Clean & readable ✔ Interview-preferred 📌 Think of it like this: enumerate(data) → [(0,"A"), (1,"B"), (2,"C")] ✅ When index is NOT needed for value in data: print(value) ✔ Simplest ✔ Cleanest 🧠 Quick Rule (Remember This!) Requirement Best Choice Only values for x in data Index + value enumerate(data) Fixed count range(n) 🎯 Interview One-Liner range() works only with numbers. For lists, use direct iteration or enumerate() instead of range(len()). Simple concept. Huge impact in interviews & real projects. If you found this useful 👇 👉 Like 👍 👉 Share 🔄 👉 Follow for daily Python & Data Engineering content 🚀 #Python #PythonInterview #LearnPython #DataEngineering #CodingTips #ETL #DeveloperCommunity #100DaysOfCode #Programming #SoftwareEngineering
To view or add a comment, sign in
-
Python Sorting Explained: sorted() vs .sort() — With Examples Sorting data is a day-to-day task for any Python developer. But choosing between sorted() and .sort() can make a big difference depending on your use case. Let’s understand it with different datasets 👇 🔹 sorted() – Built-in Function ✅ Returns a new sorted list ✅ Original data remains unchanged ✅ Works with any iterable (list, tuple, set, dict keys) ❌ Uses extra memory (creates a copy) Example (Tuple of prices): prices = (450, 120, 890, 300) sorted_prices = sorted(prices) print(sorted_prices) # [120, 300, 450, 890] print(prices) # Original tuple remains unchanged 🔹 .sort() – List Method ✅ Sorts the list in-place ✅ Faster & memory-efficient ❌ Works only on lists ❌ Returns None Example (List of employee ages): ages = [32, 25, 45, 29] ages.sort() print(ages) # [25, 29, 32, 45] 🔹 Sorting with key Example (Sort students by marks): students = [ ("Ammar", 85), ("Ali", 92), ("Zara", 78) ] students.sort(key=lambda x: x[1]) print(students Reverse Sorting Example (Descending order): scores = [88, 67, 92, 74] print(sorted(scores, reverse=True)) # [92, 88, 74, 67 Quick Rule to Remember Use sorted() when you need to keep original data Use .sort() when performance matters and modification is okay Small choices in Python can make a big impact on performance and readability. #Python #DataStructures #LearningPython #CodingTips #Programming #DataAnalysis
To view or add a comment, sign in
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
You gave a clear breakdown of this concept. Linking Excel’s references to Python’s iloc removes so much fear for most beginners. And I agree that the moment you make the effort to understand the code and not just copy paste, everything makes much sense.