Code With MEMO
Відкрити в Telegram
Join a community of passionate learners and builders! We dive deep into: 🔹 Machine Learning (Algorithms, Models, MLOps) 🔹 Coding Tips & Best Practices (Python, AI/ML, Automation) 🔸 collaborative problem solving (challenges ,Q&A....) @codewithmemo
Показати більшеКраїна не вказанаТехнології та додатки57 220
200
Підписники
-124 години
-17 днів
-130 день
Архів дописів
1. What is the output of this code?
import pandas as pd
s = pd.Series([1, 2, 3], index=['a', 'b', 'c'])
print(s.reindex(['c', 'a', 'd']))
A. Series with values [3, 1, NaN]
B. Series with values [3, 1]
C. KeyError
D. Series with values [1, 3, NaN]
Correct answer: A.
2. What does this code produce?
import pandas as pd
df = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
print(df.assign(c=lambda x: x['a'] + x['b'])['c'].iloc[1])
A. 3
B. 4
C. 5
D. 6
Correct answer: C.
3. What is the result?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
df.loc[df['a'] > 1, 'a'] = 0
print(df['a'].tolist())
A. [1, 2, 3]
B. [1, 0, 0]
C. [0, 0, 0]
D. [1, 2, 0]
Correct answer: B.
4. What does this output?
import pandas as pd
s = pd.Series([10, 20, 30], index=[2, 0, 1])
print(s.sort_index().iloc[0])
A. 10
B. 20
C. 30
D. IndexError
Correct answer: B.
5. What is returned?
import pandas as pd
df = pd.DataFrame({'a': [1, 1, 2]})
print(df['a'].value_counts().loc[1])
A. 1
B. 2
C. 3
D. KeyError
Correct answer: B.
6. What does this code output?
import pandas as pd
s = pd.Series([1, 2, 3])
print(s.map({1: 'a', 2: 'b'}).isna().sum())
A. 0
B. 1
C. 2
D. 3
Correct answer: B.
7. What is the result?
import pandas as pd
df = pd.DataFrame({'a': [1, None, 3]})
print(df['a'].astype('Int64').isna().sum())
A. 0
B. 1
C. 2
D. Raises error
Correct answer: B.
8. What does this produce?
import pandas as pd
df = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
print(df.filter(regex='a').shape)
A. (1, 2)
B. (2, 1)
C. (2, 2)
D. (1, 1)
Correct answer: B.
9. What is printed?
import pandas as pd
s = pd.Series(['1', '2', '3'])
print(s.str.cat(sep='-'))
A. 1-2-3
B. ['1-2-3']
C. Series
D. Error
Correct answer: A.
10. What does this code return?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.sample(n=1).shape)
A. (3, 1)
B. (1, 3)
C. (1, 1)
D. Depends on random seed
Correct answer: C.
11. What is the result?
import pandas as pd
s = pd.Series([1, 2, 3, 4])
print(s.rolling(2).sum().iloc[-1])
A. 4
B. 5
C. 6
D. NaN
Correct answer: B.
12. What does this output?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.eval('b = a * 2').shape)
A. (3, 1)
B. (3, 2)
C. (1, 3)
D. Error
Correct answer: B.
13. What is returned?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.query('a % 2 == 0')['a'].iloc[0])
A. 1
B. 2
C. 3
D. KeyError
Correct answer: B.
14. What does this code output?
import pandas as pd
s = pd.Series([1, 2, 3])
print(s.to_frame().shape)
A. (1, 3)
B. (3, 1)
C. (3, 3)
D. (1, 1)
Correct answer: B.
15. What is the result?
import pandas as pd
df = pd.DataFrame({'a': [1, 2]})
print(df.T.shape)
A. (2, 1)
B. (1, 2)
C. (2, 2)
D. (1, 1)
Correct answer: B.
16. What does this print?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.shift(1)['a'].isna().sum())
A. 0
B. 1
C. 2
D. 3
Correct answer: B.
17. What is the output?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.duplicated().any())
A. True
B. False
C. None
D. Error
Correct answer: B.
18. What does this code return?
import pandas as pd
s = pd.Series([3, 1, 2])
print(s.rank().tolist())
A. [3, 1, 2]
B. [1, 2, 3]
C. [3.0, 1.0, 2.0]
D. [3.0, 1.0, 2.0] sorted
Correct answer: C.
19. What is printed?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.memory_usage(deep=True).iloc[1] > 0)
A. True
B. False
C. None
D. Error
Correct answer: A.
20. What does this produce?
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df.select_dtypes(include='int').shape)
A. (3, 0)
B. (0, 1)
C. (3, 1)
D. (1, 3)
Correct answer: C.Repost from Google Developer Group AAU
🎓 AAU Blockchain Workshop — Web3 Ethiopia University Tour
The Web3 Ethiopia University Tour is landing at Addis Ababa University (AAU) 🌍
This workshop is designed to demystify blockchain and show students how Web3 can unlock global opportunities.
📍 AAU, 5 kilo
🗓 Dec 20, 2025.
🧠 Bring your laptop (PC) for live building included
You’ll learn (no prior experience needed):
🔹 Blockchain basics
🔹 Web3 fundamentals
🔹 Real-world blockchain use cases
🔹 How to build and deploy a simple smart contract
🔹 Technical & non-technical roles in Web3
🔹 How to start building, contributing & earning globally
🎁 REWARDS & GIVEAWAYS
Bring your A-game for our interactive challenges! We’ll be hosting live activities where you can score exclusive Web3 Ethiopia gear and limited-edition swag drops throughout the event.
🤝🏾 Powered by Base
🤝🏾 Hosted by Web3 Ethiopia with GDG AAU.
🔔 Join our Telegrams for updates & announcements:
👉🏾Web3 Ethiopia
👉🏾GDG AAU
🎟 Register here: https://luma.com/9ovbos8q
⚠️ Register only if you are a student at AAU.
ChatGPT is getting an adult mode.
OpenAI says it plans to roll out an age verified adult mode for ChatGPT in early 2026. The timing depends on finishing tests for its age prediction and verification systems.
Once you are verified, ChatGPT could allow more mature topics and fewer restrictions. Kids would still have stricter limits by default.
OpenAI says the idea is straightforward. Adults and minors should not be treated the same.
If this launches, ChatGPT could feel very different depending on who is using it.
@codewithmemo
@codewithmemo
The Python library PandasAI has been released for simplified data analysis using AI.
You can ask questions about the dataset in plain language directly in the AI dialogue, compare different datasets, and create graphs. It saves a lot of time, especially in the initial stage of getting acquainted with the data. It supports CSV, SQL, and Parquet.
@codewithmemo
@codewithmemo
✅ Node.js Basics You Should Know 🌐
Node.js lets you run JavaScript on the server side, making it great for building fast, scalable backend applications. 🚀
1️⃣ What is Node.js?
Node.js is a runtime built on Chrome's V8 JavaScript engine. It enables running JS outside the browser, mainly for backend development. 🖥️
2️⃣ Why Use Node.js?
- Fast & non-blocking (asynchronous) ⚡
- Huge npm ecosystem 📦
- Same language for frontend & backend 🔄
- Ideal for APIs, real-time apps, microservices 💬
3️⃣ Core Concepts:
- Modules: Reusable code blocks (e.g.,
fs, http, custom modules) 🧩
- Event Loop: Handles async operations ⏳
- Callbacks & Promises: For non-blocking code 🤝
4️⃣ Basic Server Example:
const http = require('http');
http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, Node.js!');
}).listen(3000); // Server listening on port 3000
5️⃣ npm (Node Package Manager):
Install libraries like Express, Axios, etc.
npm init
npm install express
6️⃣ Express.js (Popular Framework):
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Hello World!'));
app.listen(3000, () => console.log('Server running on port 3000'));
7️⃣ Working with JSON & APIs:
app.use(express.json()); // Middleware to parse JSON body
app.post('/data', (req, res) => {
console.log(req.body); // Access JSON data from request body
res.send('Received!');
});
8️⃣ File System Module (fs):
const fs = require('fs');
fs.readFile('file.txt', 'utf8', (err, data) => {
if (err) throw err;
console.log(data); // Content of file.txt
});
9️⃣ Middleware in Express:
Functions that run before reaching the route handler.
app.use((req, res, next) => {
console.log('Request received at:', new Date());
next(); // Pass control to the next middleware/route handler
});
🔟 Real-World Use Cases:
- REST APIs 📊
- Real-time apps (chat, notifications) 💬
- Microservices 🏗️
- Backend for web/mobile apps 📱
💡 Tip: Once you're confident, explore MongoDB, JWT auth, and deployment with platforms like Vercel or Render.K-means is one of the most widely used clustering algorithms in data science and machine learning. A key part of the algorithm is convergence (a process in which cluster centers and point assignments gradually stabilize due to repeated updates). To put it simply, understanding how and why convergence occurs helps to obtain reliable and meaningful clustering results.
✔️ It converges quickly on most datasets, making it effective for large-scale tasks
✔️ It offers a simple and interpretable structure for identifying groups
✔️ It scales well on large data sets due to its low computational complexity
❌ The results heavily depend on the initial clustering initialization
❌ It can distort the data structure if the features are incorrectly scaled
❌ It can generate empty or unstable clusters if configured incorrectly
To ensure stable convergence:
- Use k-means++ for a more informed selection of initial centers
- Apply feature scaling to prevent variables with large scales from dominating
- Set appropriate values for the iteration limit and convergence threshold
The image shows the K-means convergence process. Data points are assigned to the nearest center based on the square of the distance. After that, each center is recalculated as the average of all points assigned to it. These steps are repeated until the positions of the centers no longer change significantly.
@codewithmemo
@codewithmemo
How People Use ChatGPT:
OpenAI says ChatGPT now has over 800 million weekly users. That’s around 10 percent of the world’s adult population, just three years after launch.
New research shows how people actually use it. More than 70% of conversations are now non-work related, up from 53% early on. When it is used for work, writing dominates, far ahead of search, coding, or analysis.
Nick Turley, head of ChatGPT, put it simply: “That leaves at least 90 percent to go.”
@codewithmemo
@codewithmemo
🔍 Exploring the Power of Support Vector Machines (SVM) in Machine Learning!
🚀 Support Vector Machines are a powerful class of supervised learning algorithms that can be used for both classification and regression tasks. They have gained immense popularity due to their ability to handle complex datasets and deliver accurate predictions. Let's explore some key aspects that make SVMs stand out:
1️⃣ Robustness: SVMs are highly effective in handling high-dimensional data, making them suitable for various real-world applications such as text categorization and bioinformatics. Their robustness enables them to handle noise and outliers effectively.
2️⃣ Margin Maximization: One of the core principles behind SVM is maximizing the margin between different classes. By finding an optimal hyperplane that separates data points with the maximum margin, SVMs aim to achieve better generalization on unseen data.
3️⃣ Kernel Trick: The kernel trick is a game-changer when it comes to SVMs. It allows us to transform non-linearly separable data into higher-dimensional feature spaces where they become linearly separable. This technique opens up possibilities for solving complex problems that were previously considered challenging.
4️⃣ Regularization: SVMs employ regularization techniques like L1 or L2 regularization, which help prevent overfitting by penalizing large coefficients. This ensures better generalization performance on unseen data.
5️⃣ Versatility: SVMs offer various formulations such as C-SVM (soft-margin), ν-SVM (nu-Support Vector Machine), and ε-SVM (epsilon-Support Vector Machine). These formulations provide flexibility in handling different types of datasets and trade-offs between model complexity and error tolerance.
6️⃣ Interpretability: Unlike some black-box models, SVMs provide interpretability. The support vectors, which are the data points closest to the decision boundary, play a crucial role in defining the model. This interpretability helps in understanding the underlying patterns and decision-making process.
As machine learning continues to revolutionize industries, Support Vector Machines remain a valuable tool in our arsenal. Their ability to handle complex datasets, maximize margins, and transform non-linear data make them an essential technique for tackling challenging problems.
@codewithmemo
@codewithmemo
Вже доступно! Дослідження Telegram за 2025 — головні інсайти року 
