PyData Careers – Telegram
PyData Careers
21.3K subscribers
229 photos
6 videos
26 files
382 links
Python Data Science jobs, interview tips, and career insights for aspiring professionals.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
🔥 Generating fake data in Python — no pain at all

If you're testing forms, mockups, or just want to play with data, there's Mimesis — a generator of fake data. Names, emails, addresses, and phone numbers. There's a location setting that allows you to select a country, and the data will be generated accordingly.

📦 Installation:
from typing import Dict
from mimesis.enums import Gender
from mimesis import Person

def generate_fake_user(locale: str = "es", gender: Gender = Gender.MALE) -> Dict[str, str]:
    """
    Generates fake user data based on the locale and gender.

    :param locale: The locale (for example, 'ru', 'en', 'es')
    :param gender: The gender (Gender.MALE or Gender.FEMALE)
    :return: A dictionary with the fake user data
    """
    person = Person(locale)

    user_data = {
        "name": person.full_name(gender=gender),
        "height": person.height(),
        "phone": person.telephone(),
        "occupation": person.occupation(),
    }

    return user_data

if __name__ == "__main__":
    fake_user = generate_fake_user(locale="es", gender=Gender.MALE)
    print(fake_user)


📌 Result:
{
  'name': 'Carlos Herrera',
  'height': '1.84',
  'phone': '912 475 289',
  'occupation': 'Arquitecto'
)


⚡️ Mimesis can:
🖱 Generate names, addresses, phone numbers, professions, etc. 
🖱 Work with different countries (🇷🇺 ru, 🇺🇸 en, 🇪🇸 es, etc.) 
🖱 Suitable for tests, fake accounts, demo data in projects, and bots.

⚙️ GitHub/Instructions

Save it, it'll come in handy 👍

#python #github #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
5
Interview question

How to manage caching in HTTP?

Answer: Caching in HTTP is managed using special headers that determine when and how downloaded data can be reused.

▶️ Cache-Control — the main header that sets caching rules: lifetime (max-age), accessibility (public, private), caching prohibition (no-store), etc.

▶️ Last-Modified + If-Modified-Since — allow the server to report the date of the last resource modification, and the client to request data only when it has been updated

▶️ ETag + If-None-Match — use a unique version identifier of the resource. If the version has not changed, the server responds with 304 Not Modified

These mechanisms reduce the network load and speed up reloads.


tags: #interview

@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
7
🗂 Cheat Sheet on Beautiful Soup 4 (bs4) in Python: HTML/XML Parsing Made Easy and Simple

Beautiful Soup — a library for extracting data from HTML and XML files, ideal for web scraping.

🔹 Installation
pip install beautifulsoup4


🔹 Import
from bs4 import BeautifulSoup
import requests


🔹 Basic Parsing
html_doc = "<html><body><p class='text'>Hello, world!</p></body></html>"
soup = BeautifulSoup(html_doc, 'html.parser')  # or 'lxml', 'html5lib'
print(soup.p.text)  # Hello, world!


🔹 Element Search
# First found element
first_p = soup.find('p')

# Search by class or attribute
text_elem = soup.find('p', class_='text')
text_elem = soup.find('p', {'class': 'text'})

# All elements
all_p = soup.find_all('p')
all_text_class = soup.find_all(class_='text')


🔹 Working with Attributes and Text
a_tag = soup.find('a')
print(a_tag['href&#39])    # value of the href attribute
print(a_tag.get_text()) # text inside the tag
print(a_tag.text)       # alternative


🔹 Navigating the Tree
# Moving to parent, children, siblings
parent = soup.p.parent
children = soup.ul.children
next_sibling = soup.p.next_sibling

# Finding the previous/next element
prev_elem = soup.find_previous('p')
next_elem = soup.find_next('div')


🔹 Parsing a Real Page
response = requests.get('https://example.com')
soup = BeautifulSoup(response.text, 'html. parser')
noscript = soup.noscript.text
links = [a['href'] for a in soup.find_all('a', href=True)]


🔹 CSS Selectors
# More powerful and concise search
items = soup.select('div.content > p.text')
first_item = soup.select_one('a.button')


💡 Where it's useful:
🟢 Web scraping and data collection
🟢 Processing HTML/XML reports
🟢 Automating data extraction from websites
🟢 Preparing data for analysis and machine learning


👩‍💻 @CodeProgrammer
Please open Telegram to view this post
VIEW IN TELEGRAM
8🥰1
Interview question

What is a closure?

Answer: A closure is a function that remembers variables from its outer scope and continues to use them, even if that scope has already left the active area.

How does a closure work?
▶️The outer function creates local variables and a nested function
▶️This nested function uses the variables of the outer function
▶️The outer function returns the nested function, which continues to "remember" these variables, even if the outer function has already finished

This is useful when you need to pass a state or data without using global variables.


tags: #interview

@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
4
📂 A reminder for working with HTTP requests!

For example, GET is used to retrieve data, POST — to create new records, and DELETE — to delete.

In the picture — the 9 most popular HTTP request methods that every developer should have at hand.

Save it so you don't forget!

🚪@DataScienceQ   | #resource
Please open Telegram to view this post
VIEW IN TELEGRAM
2
🙏💸 500$ FOR THE FIRST 500 WHO JOIN THE CHANNEL! 🙏💸

Join our channel today for free! Tomorrow it will cost 500$!

https://news.1rj.ru/str/+0-w7MQwkOs02MmJi

You can join at this link! 👆👇

https://news.1rj.ru/str/+0-w7MQwkOs02MmJi
Question from the interview

What is monkey patching?

Answer: Monkey patching is a technique of changing the behavior of code during execution, in which methods or attributes of an object are dynamically replaced or added. This allows you to change the functionality of a class without changing its source code.

tags: #interview

@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
4
Python Clean Code: Stop Writing Bad Code — Lessons from Uncle Bob

Are you tired of writing messy and unorganized code that leads to frustration and bugs? You can transform your code from a confusing mess into something crystal clear with a few simple changes. In this article, we'll explore key principles from the book "Clean Code" by Robert C. Martin, also known as Uncle Bob, and apply them to Python. Whether you're a web developer, software engineer, data analyst, or data scientist, these principles will help you write clean, readable, and maintainable Python code.

Read: https://habr.com/en/articles/841820/

https://news.1rj.ru/str/CodeProgrammer 🧠
Please open Telegram to view this post
VIEW IN TELEGRAM
3
Integrating Local LLMs with Ollama and Python 🤖💻

Did you know that integrating local large language models (LLMs) into your Python projects can help improve privacy, reduce costs, and build offline-capable AI-powered apps? 👉

To get started, follow these steps:

• Set up Ollama and pull the models you want to use.
• Connect to them from Python using the <code>ollama</code> library.

Watch this video on how to integrate OLLAMA into your python projects https://youtu.be/E4l91XKQSgw?si=3gaeoM3EbvO6QYIC

Key Benefits:

• Improved privacy
• Reduced costs
• Offline-capable AI-powered apps
1
Uv vs Pip: Choosing the Right Package Manager for Your Python Projects 👉

When it comes to choosing a package manager for your Python projects, you have two popular options: uv and pip. While both tools share many similarities, there are key differences that may sway your decision.

* pip: Great for out-of-the-box availability, broad compatibility, and reliable ecosystem support. It's perfect for new projects or when you need to install popular packages quickly.
* uv: Worth considering if you prioritize fast installs, reproducible environments, and clean uninstall behavior. uv is ideal for streamline workflows for new projects, and its custom installation process can be beneficial for large-scale applications.

Here's a quick summary of the key differences:

* Package Installation: 📦
* pip: Easy to install popular packages using pip.
* uv: Requires manual package management, but can lead to faster installs and more reproducible environments.
* Dependency Management: 💻
* pip: Provides automatic dependency resolution for most projects.
* uv: Requires custom dependency management, which can be beneficial for complex projects.

By considering these factors and comparing the two tools, you'll make an informed decision that suits your specific needs.
2
🚀 Lightweight X11 App Launcher for Python 🎉

X11 app launchers are powerful tools that can greatly enhance your Python development experience. However, creating a custom launcher from scratch can be challenging and time-consuming.

Here's why:

*   Performance: Creating a native X11 application requires a deep understanding of C, X11, and the underlying operating system.
*   Portability: Building a cross-platform application can be difficult due to the varying differences between platforms.
*   Customizability: Custom launchers require a good grasp of the underlying architecture and configuration options.

On the other hand, you can use existing libraries like pywinauto or pyppeteer to create a lightweight X11 app launcher for Python.

In this example, we'll create a simple launcher using pywinauto, which provides an easy-to-use API for automating desktop applications.

### Example Code

import pywinauto

def launch_app():
    # Create the main window
    app = pywinauto.application().start('MyApp')

    # Launch the main menu
    menu = app.top_menu()
    menu.show()

# Start the application
launch_app()

### Features

*   Native X11 Application: This launcher uses the native X11 API to create a seamless desktop experience.
*   Easy-to-Use Interface: The pywinauto library provides an intuitive API, making it easy to customize and extend the launcher.

### Benefits

*   High Performance: The native X11 application ensures optimal performance and responsiveness.
*   Cross-Platform Compatibility: This launcher is designed to be cross-platform, making it suitable for deployment on various operating systems.

By using pywinauto to create a lightweight X11 app launcher for Python, you can take advantage of the power of C and X11 while still enjoying a seamless desktop experience. Give this example a try and see how it can enhance your Python development workflow!
2
Interview question

How to sort a list of dictionaries by a specific field?

Answer: To sort a list of dictionaries by a specific field, for example, by age, you can use the .sort() method or the sorted() function with the key parameter.

This parameter passes a function that extracts the value of the desired field from each dictionary. The .sort() method modifies the list in place, while sorted() returns a new sorted list.


tags: #interview

@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
1
Media is too big
VIEW IN TELEGRAM
Ant AI Automated Sales Robot is an intelligent robot focused on automating lead generation and sales conversion. Its core function simulates human conversation, achieving end-to-end business conversion and easily generating revenue without requiring significant time investment.

I. Core Functions: Fully Automated "Lead Generation - Interaction - Conversion"

Precise Lead Generation and Human-like Communication: Ant AI is trained on over 20 million real social chat records, enabling it to autonomously identify target customers and build trust through natural conversation, requiring no human intervention.

High Conversion Rate Across Multiple Scenarios: Ant AI intelligently recommends high-conversion-rate products based on chat content, guiding customers to complete purchases through platforms such as iFood, Shopee, and Amazon. It also supports other transaction scenarios such as movie ticket purchases and utility bill payments.

24/7 Operation: Ant AI continuously searches for customers and recommends products. You only need to monitor progress via your mobile phone, requiring no additional management time.

II. Your Profit Guarantee: Low Risk, High Transparency, Zero Inventory Pressure, Stable Commission Sharing

We have established partnerships with platforms such as Shopee and Amazon, which directly provide abundant product sourcing. You don't need to worry about inventory or logistics. After each successful order, the company will charge the merchant a commission and share all profits with you. Earnings are predictable and withdrawals are convenient. Member data shows that each bot can generate $30 to $100 in profit per day. Commission income can be withdrawn to your account at any time, and the settlement process is transparent and open.

Low Initial Investment Risk. Bot development and testing incur significant costs. While rental fees are required, in the early stages of the project, the company prioritizes market expansion and brand awareness over short-term profits.

If you are interested, please join my Telegram group for more information and leave a message: https://news.1rj.ru/str/+lVKtdaI5vcQ1ZDA1
1
Question from the interview

How to organize a message queue via Redis?

Answer: A message queue in Redis can be implemented in various ways. The simplest option is to use lists, where the producer adds messages and the worker retrieves them in FIFO order. This is fast, but requires careful handling of failures.

A more reliable approach is Redis Streams, which support groups of consumers and message processing confirmation, which helps to avoid losses. Pub/Sub is usually not used for queues, as messages are not stored and can be lost.


tags: #interview

@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
2
This project uses YOLOv8 for object detection, OpenCV for video processing, and custom-defined security zones to detect intrusions in restricted areas. When a person enters a defined zone, the system triggers an alert sound and automatically captures snapshots for evidence.


https://youtu.be/W2T2PgVIV3A?si=6Pf_c0veplMHIvDJ
3
What are the list methods in Python?

append() — adds an element to the end of the list
pop() — removes the last element of the list (or the element at a given index)
insert() — adds an element at any position in the list by index
remove() — removes the first found element from the list by value
map() — applies a function to each element and returns an iterator (can be converted to a list)
filter() — selects elements that satisfy a condition and returns an iterator
reduce() (from the functools module) — reduces the list to a single value by processing elements sequentially


@DataScienceQ
4
❗️LISA HELPS EVERYONE EARN MONEY!$29,000 HE'S GIVING AWAY TODAY!

Everyone can join his channel and make money! He gives away from $200 to $5.000 every day in his channel

https://news.1rj.ru/str/+HDFF3Mo_t68zNWQy

⚡️FREE ONLY FOR THE FIRST 500 SUBSCRIBERS! FURTHER ENTRY IS PAID! 👆👇

https://news.1rj.ru/str/+HDFF3Mo_t68zNWQy
When deploying and running Python code on cloud-based clusters using Ray, one specific technical detail to focus on is the use of ray.remote decorator.

When applying the @ray.remote decorator to your Python functions, ensure that each function takes a single argument (the object being acted upon) and returns a value. This allows Ray to properly serialize and de-serialize data for distributed computing. For example:
import ray

@ray.remote
def my_function(x):
    # do some computation on x
    return result

Source: https://towardsdatascience.com/ray-distributed-computing-for-all-part-2/
5
Question from the interview

Why shouldn't you compare two float values using "=="?

Answer: A comparison using == might return False, even if the numbers appear to be equal. Instead, it's better to use math.isclose(a, b), which compares two numbers taking into account the allowable deviation (rel_tol and abs_tol) and ensures a correct comparison.

tags: #interview

@DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
2👍1