Аналитика Telegram-канала
Подписчики
63
Охват за 24 ч
3
ER за 24 ч
4,76%
Публикаций
21
Динамика подписчиков
7 дней
30 дней
6 месяцев
Больше
21 ноя24 ноя27 ноя
Показаны последние 7 дней
Больше истории →
Охваты публикаций
11.1111.1113.1116.1120.1122.11
2
Средний охват
5
Лучший результат
Показаны 6 публикаций — последние в канале
Больше статистики →
Упоминания
1
Упоминаний
1
Из них репостов
1
Каналов
2
Упоминаний за 90 дней
2
Из них репостов
2
Каналов за 90 дней
Последние посты
3 из 21 2 из 21Day #11
String Operations: what happens when you look at your text columns and they are a mess? Maybe some names are lowercase, some have extra spaces, or you need to find a specific word.
In Pandas, you can apply Python string methods to an entire column at once using the `.str` accessor. It’s like doing a "Find and Replace" in Excel, but on steroids.
Common String Methods:
- .str.lower() / .str.upper() → Change the case of the whole column.
- .str.strip() → Remove leading and trailing spaces.
- .str.contains('word') → Check if a specific word exists (returns True/False).
- .str.replace('old', 'new') → Replace a substring with something else.
- .str.split('separator') → Split a string into a list based on a delimiter.
Basic syntax
import pandas as pd
data = {
'Email': [' Ali@email.com ', 'sara@email.com', 'JOHN@email.com']
}
df = pd.DataFrame(data)
# 1. Clean up spaces and make everything lowercase
df['Email'] = df['Email'].str.strip().str.lower()
# 2. Filter rows that contain 'john'
john_df = df[df['Email'].str.contains('john')]
# 3. Replace '.com' with '.net'
df['Email'] = df['Email'].str.replace('.com', '.net')
print(df)
Tip: If you are using .str.contains() and want to ignore uppercase/lowercase, just add case=False inside the parentheses! Example: df['Name'].str.contains('ali', case=False).
ещё
1
0
22 ноя, 22:32
Day #10
Merging & Joining : In the real world, your data is rarely all in one place. You might have a table of Customers and a separate table of Orders.
To analyze them together, you need to combine them. If you know Excel, think of pd.merge() as VLOOKUP on steroids. It lets you join two DataFrames together based on a shared column (a "key").
The 4 Types of Joins (using `how=`):
1. `inner` (Default): Only keeps rows where the key exists in *both* tables.
2. `left`: Keeps all rows from the left table and matches from the right (fills with NaN if no match).
3. `right`: Keeps all rows from the right table and matches from the left.
4. `outer`: Keeps *everything* from both tables.
Basic syntax
import pandas as pd
# Table 1: Customers
customers = pd.DataFrame({
'ID': [1, 2, 3],
'Name': ['Ali', 'Sara', 'John']
})
# Table 2: Orders
orders = pd.DataFrame({
'ID': [1, 2, 4],
'Amount': [500, 300, 200]
})
# 1. Inner Join (Only IDs 1 and 2 match)
inner_df = pd.merge(customers, orders, on='ID', how='inner')
# 2. Left Join (Keeps Ali, Sara, and John)
left_df = pd.merge(customers, orders, on='ID', how='left')
print(left_df)
Tip: The on='ID' parameter is crucial. The column you join on must exist in both DataFrames. If the columns have different names (like customer_id and id), you can use left_on='customer_id' and right_on='id' instead.
ещё
1
0
20 ноя, 23:23
Day #9
Sorting & Ranking : After grouping and aggregating the next question is usually: "Who is the best?" or "What are our top 5 sales?"
To answer that, we need to sort our data. In Excel, you click the filter arrow and select "Sort A-Z". In Pandas, we use sort_values().
1. Sorting by a column:
df.sort_values(by='Column_Name') (Sorts from smallest to largest by default).
2. Sorting in descending order:
Add ascending=False to go from largest to smallest.
3. Sorting by multiple columns:
Pass a list of column names. Pandas will sort by the first, and if there are ties, it uses the second.
Basic syntax
import pandas as pd
data = {
'Name': ['Ali', 'Sara', 'John', 'Marta'],
'Sales': [500, 750, 500, 900],
'Region': ['North', 'South', 'North', 'East']
}
df = pd.DataFrame(data)
# 1. Sort by Sales (Lowest to Highest)
print(df.sort_values(by='Sales'))
# 2. Sort by Sales (Highest to Lowest)
print(df.sort_values(by='Sales', ascending=False))
# 3. Sort by Sales (Highest first), then by Region (A-Z) for ties
print(df.sort_values(by=['Sales', 'Region'], ascending=[False, True]))
Tip: Just like creating columns, sorting doesn't save automatically! If you want to permanently change your DataFrame, you have to either save it back to itself (df = df.sort_values(...)) or use inplace=True inside the parentheses.
✌️
ещё
1
0
16 ноя, 20:53
Продолжить анализ этого канала
- История роста подписчиков
- Просмотры и охваты публикаций
- Кто упоминает канал и кого упоминает он
- Похожие каналы и подбор для рекламы
Открыть аналитику
Демо до 14 дней