Data Analytics
Perfect channel to learn Data Analytics Learn SQL, Python, Alteryx, Tableau, Power BI and many more For Promotions: @coderfun @love_data
Mostrar más📈 Análisis del canal de Telegram Data Analytics
El canal Data Analytics (@sqlspecialist) en el segmento lingüístico de Inglés es un actor destacado. Actualmente la comunidad reúne a 110 015 suscriptores, ocupando la posición 1 100 en la categoría Tecnologías y Aplicaciones y el puesto 2 169 en la región India.
📊 Métricas de audiencia y dinámica
Desde su creación el невідомо, el proyecto ha mostrado un crecimiento acelerado, reuniendo a 110 015 suscriptores.
Según los últimos datos del 04 diciembre, 2026, el canal mantiene una actividad estable. En los últimos 30 días la variación de miembros fue de -486, y en las últimas 24 horas de -7, conservando un alto alcance.
- Estado de verificación: No verificado
- Tasa de interacción (ER): El promedio de interacción de la audiencia es 2.73%. Durante las primeras 24 horas tras publicar, el contenido suele obtener 1.26% de reacciones respecto al total de suscriptores.
- Alcance de las publicaciones: Cada publicación recibe en promedio 3 001 visualizaciones. En el primer día suele acumular 1 386 visualizaciones.
- Reacciones e interacción: La audiencia responde de forma activa: el promedio de reacciones por publicación es 5.
- Intereses temáticos: El contenido se centra en temas clave como row, sql, analytic, analyst, visualization.
📝 Descripción y política de contenido
El autor describe el recurso como un espacio para expresar opiniones subjetivas:
“Perfect channel to learn Data Analytics
Learn SQL, Python, Alteryx, Tableau, Power BI and many more
For Promotions: @coderfun @love_data”
Gracias a la alta frecuencia de actualizaciones (últimos datos recibidos el 05 diciembre, 2026), el canal mantiene la vigencia y un amplio alcance. La analítica demuestra que la audiencia interactúa activamente con el contenido, lo que lo convierte en un punto de referencia dentro de la categoría Tecnologías y Aplicaciones.
orders_per_customer = (
df.groupby("customer_id")["order_id"]
.nunique()
)
repeat_customers = (
orders_per_customer > 1
).sum()
total_customers = len(orders_per_customer)
repeat_purchase_rate = (
repeat_customers / total_customers
) * 100
print(repeat_purchase_rate)
8️⃣ How would you calculate the conversion rate?
Sample Answer:
Conversion rate measures the percentage of visitors who complete a desired action.
Formula:
Conversion Rate = (Conversions / Total Visitors) × 100
total_visitors = 10000
conversions = 750
conversion_rate = (
conversions / total_visitors
) * 100
print(conversion_rate)
9️⃣ How would you identify the most valuable customers?
Sample Answer:
We can use RFM analysis, which evaluates customers based on:
• Recency: How recently they purchased.
• Frequency: How often they purchased.
• Monetary: How much they spent.
Example:
reference_date = pd.Timestamp("2026-12-01")
rfm = df.groupby("customer_id").agg(
recency=("order_date",
lambda x: (reference_date - x.max()).days),
frequency=("order_id", "nunique"),
monetary=("revenue", "sum")
)
print(rfm.head())
Customers with lower recency and higher frequency and monetary values are generally more valuable.
🔟 How would you calculate the sales growth rate between two periods?
Sample Answer:
Sales growth measures the percentage increase or decrease in sales compared with a previous period.
Formula:
Growth Rate = ((Current Sales − Previous Sales) / Previous Sales) × 100
previous_sales = 500000
current_sales = 650000
growth_rate = (
(current_sales - previous_sales)
/ previous_sales
) * 100
print(growth_rate)
This gives a sales growth rate of 30%.
Double Tap ❤️ For Morestarting_customers = 1000
ending_customers = 900
new_customers = 200
retention_rate = (
(ending_customers - new_customers)
/ starting_customers
) * 100
print(retention_rate)
2️⃣ How would you identify customers who purchased only once?
Sample Answer:
We can use groupby() and nunique() to count unique orders for each customer.
order_counts = (
df.groupby("customer_id")["order_id"]
.nunique()
)
one_time_customers = order_counts[
order_counts == 1
]
print(one_time_customers)
3️⃣ How would you calculate customer lifetime value (CLV) using transaction data?
Sample Answer:
A basic historical CLV calculation is the total revenue generated by each customer.
customer_clv = (
df.groupby("customer_id")["revenue"]
.sum()
.reset_index(name="CLV")
)
print(customer_clv)
More advanced CLV models may consider customer lifespan, purchase frequency, margins and future revenue.
4️⃣ How would you calculate the churn rate?
Sample Answer:
Churn rate measures the percentage of customers lost during a specific period.
Formula:
Churn Rate = (Customers Lost / Customers at Start) × 100
customers_at_start = 1000
customers_lost = 100
churn_rate = (
customers_lost / customers_at_start
) * 100
print(churn_rate)
5️⃣ How would you identify customers who haven't purchased in the last 90 days?
Sample Answer:
We can compare each customer's most recent purchase date with a reference date.
df["order_date"] = pd.to_datetime(
df["order_date"]
)
reference_date = pd.Timestamp("2026-12-01")
last_purchase = (
df.groupby("customer_id")["order_date"]
.max()
)
inactive_customers = last_purchase[
last_purchase < reference_date - pd.Timedelta(days=90)
]
print(inactive_customers)
This identifies customers whose latest recorded purchase was more than 90 days before the reference date.
6️⃣ What is cohort analysis, and how would you perform it using Python?
Sample Answer:
Cohort analysis groups customers based on a shared characteristic, such as their first purchase month, and tracks their behaviour over time.
Example:
df["order_date"] = pd.to_datetime(
df["order_date"]
)
df["order_month"] = (
df["order_date"].dt.to_period("M")
)
df["cohort_month"] = (
df.groupby("customer_id")["order_date"]
.transform("min")
.dt.to_period("M")
)
cohort_data = (
df.groupby(["cohort_month", "order_month"])
["customer_id"]
.nunique()
)
print(cohort_data)
This provides the number of active customers from each acquisition cohort in each order month. A retention matrix can then be calculated from these counts.
7️⃣ How would you calculate the repeat purchase rate?
Sample Answer:
Repeat purchase rate measures the percentage of customers who have made more than one purchase.groupby(), sum(), and nlargest().
top_customers = (
df.groupby("customer_id")["sales"]
.sum()
.nlargest(5)
)
print(top_customers)
2️⃣ How would you identify duplicate customer records?
Sample Answer:
We can use duplicated() to identify duplicate records based on selected columns.
duplicates = df[
df.duplicated(
subset=["customer_id"],
keep=False
)
]
3️⃣ How would you find customers who haven't placed any orders?
Sample Answer:
We can use a left merge with an indicator to identify unmatched customers.
result = customers.merge(
orders,
on="customer_id",
how="left",
indicator=True
)
inactive_customers = result[
result["_merge"] == "left_only"
]
This identifies customers who do not have matching records in the orders dataset.
4️⃣ How would you calculate each product's contribution to total revenue?
Sample Answer:
First, calculate product-wise revenue and then divide it by total revenue.
product_sales = (
df.groupby("product")["revenue"]
.sum()
)
contribution = (
product_sales / product_sales.sum()
) * 100
print(contribution)
5️⃣ How would you find the second-highest salary in a dataset?
Sample Answer:
We can use nlargest() or unique() with sorting.
second_highest = (
df["salary"]
.dropna()
.drop_duplicates()
.nlargest(2)
.iloc[-1]
)
This returns the second-highest distinct salary.
6️⃣ How would you calculate the average order value for each customer?
Sample Answer:
Average Order Value (AOV) is calculated by dividing total revenue by the number of orders.
customer_aov = (
df.groupby("customer_id")
.agg(
total_revenue=("revenue", "sum"),
total_orders=("order_id", "nunique")
)
)
customer_aov["AOV"] = (
customer_aov["total_revenue"] /
customer_aov["total_orders"]
)
7️⃣ How would you identify sales that are above the average sales of their region?
Sample Answer:
We can use transform() to calculate the regional average and compare each transaction against it.
df["region_avg"] = (
df.groupby("region")["sales"]
.transform("mean")
)
above_average = df[
df["sales"] > df["region_avg"]
]
8️⃣ How would you calculate month-over-month revenue growth?
Sample Answer:
We can use groupby(), resample(), and pct_change().
df["date"] = pd.to_datetime(df["date"])
monthly_revenue = (
df.set_index("date")["revenue"]
.resample("MS")
.sum()
)
monthly_growth = (
monthly_revenue.pct_change() * 100
)
This calculates the percentage change in revenue compared with the previous month.
9️⃣ How would you handle missing values in a sales dataset?
Sample Answer:
First, identify missing values and understand why they are missing. Then choose an appropriate treatment.
# Check missing values
print(df.isnull().sum())
# Fill missing sales with median
df["sales"] = df["sales"].fillna(
df["sales"].median()
)
# Remove rows missing critical identifiers
df = df.dropna(
subset=["customer_id"]
)
The treatment depends on the business context. We should not blindly replace every missing value.
🔟 How would you identify the best-performing region?
Sample Answer:
We can aggregate sales by region and sort the results.
region_performance = (
df.groupby("region")["sales"]
.sum()
.sort_values(ascending=False)
)
best_region = region_performance.idxmax()
print(best_region)
This identifies the region with the highest total sales.df["profit_margin"] = (
df["profit"] / df["revenue"] * 100
)
Always handle zero or missing revenue values appropriately to avoid invalid results.
🔟 How would you create customer spending categories using Pandas?
We can combine groupby(), sum(), and cut() to categorize customers based on their total spending.
customer_spending = (
df.groupby("customer_id")["sales"]
.sum()
.reset_index()
)
customer_spending["category"] = pd.cut(
customer_spending["sales"],
bins=[0, 1000, 5000, float("inf")],
labels=["Low", "Medium", "High"],
include_lowest=True
)
This helps segment customers based on their total spending.
📌 Double Tap ❤️ For More
-----
2.17 ₽ · /balance_helpdf.query("salary > 50000")
Multiple conditions:
df.query("salary > 50000 and age < 30")
2️⃣ What is the difference between loc[] and query()?
• loc[] is label-based indexing and supports flexible row and column selection.
• query() is mainly used to filter rows using expressions.
df.loc[df["salary"] > 50000]
df.query("salary > 50000")
Both can filter rows based on conditions.
3️⃣ What is pipe() in Pandas?
pipe() allows us to pass a DataFrame through multiple functions in a clean and readable way.
def filter_data(df):
return df[df["salary"] > 50000]
def sort_data(df):
return df.sort_values("salary", ascending=False)
result = (
df.pipe(filter_data)
.pipe(sort_data)
)
It helps organize complex data-cleaning workflows.
4️⃣ What is the difference between cut() and qcut()?
Both functions divide continuous numerical data into categories.
• cut() creates bins based on specified value ranges.
• qcut() creates bins based on quantiles, aiming for approximately equal numbers of observations per bin.
df["age_group"] = pd.cut(
df["age"],
bins=[0, 18, 35, 60, 100],
labels=["Child", "Young", "Adult", "Senior"]
)
Using qcut():
df["salary_group"] = pd.qcut(
df["salary"],
q=4,
labels=["Low", "Medium", "High", "Very High"]
)
5️⃣ What is explode() in Pandas?
explode() converts elements in a list-like column into separate rows.
df = pd.DataFrame({
"employee": ["A", "B"],
"skills": [
["Python", "SQL"],
["Excel", "Power BI"]
]
})
result = df.explode("skills")
Each skill gets its own row while the employee name is repeated.
6️⃣ What is get_dummies() in Pandas?
get_dummies() converts categorical variables into indicator columns, commonly used for one-hot encoding.
df = pd.DataFrame({
"department": ["HR", "IT", "Finance", "IT"]
})
encoded = pd.get_dummies(
df,
columns=["department"],
dtype=int
)
It creates separate columns for each department category.
7️⃣ What is the difference between astype() and to_numeric()?
• astype() converts a column into a specified data type.
• pd.to_numeric() specifically converts values into numeric types and can handle invalid values using errors="coerce".
df["age"] = df["age"].astype("int64")
Using to_numeric():
df["sales"] = pd.to_numeric(
df["sales"],
errors="coerce"
)
Invalid numeric values become NaN when using errors="coerce".
8️⃣ How do you find the top N records in a DataFrame?
We can use nlargest() or nsmallest().
top_5 = df.nlargest(5, "sales")
For the lowest five sales:
bottom_5 = df.nsmallest(5, "sales")
These methods are useful for quickly identifying top-performing or underperforming records.
9️⃣ How do you calculate the difference between two columns?
We can directly subtract one column from another.
df["profit"] = (
df["revenue"] - df["cost"]
)
To calculate profit margin:map() is used on a Series to map or replace individual values.
- apply() applies a function to a Series or along rows or columns of a DataFrame.
- DataFrame.map() applies a function element-wise to every value in a DataFrame.
Example:
df["salary"].map(lambda x: x * 1.10)
2️⃣ What is the difference between apply() and transform() in GroupBy?
Sample Answer:
- apply() offers flexibility and can return different shapes of output.
- transform() returns results aligned with the original rows, making it useful for creating new columns.
Example:
df["dept_avg"] = (
df.groupby("department")["salary"]
.transform("mean")
)
This adds the average salary of each department to every employee's row.
3️⃣ What is rolling() in Pandas?
Sample Answer:
rolling() performs calculations over a moving window of observations.
It is commonly used to calculate moving averages and smooth time-series data.
Example:
df["moving_avg"] = (
df["sales"].rolling(window=3).mean()
)
This calculates the average sales of the current row and previous two rows.
4️⃣ What is the difference between rolling() and expanding()?
Sample Answer:
- rolling() calculates values over a fixed-size window.
- expanding() calculates values using all observations from the beginning up to the current row.
Example:
df["rolling_avg"] = df["sales"].rolling(3).mean()
df["expanding_avg"] = df["sales"].expanding().mean()
5️⃣ How do you calculate cumulative sales in Pandas?
Sample Answer:
We use cumsum() to calculate the running total.
Example:
df["cumulative_sales"] = df["sales"].cumsum()
For department-wise cumulative sales:
df["cumulative_sales"] = (
df.groupby("department")["sales"]
.cumsum()
)
6️⃣ How do you calculate percentile rank in Pandas?
Sample Answer:
We use rank(pct=True) to calculate the relative rank of each value.
Example:
df["sales_percentile"] = (
df["sales"].rank(pct=True) * 100
)
This assigns each sales value a percentile rank.
7️⃣ What is shift() in Pandas?
Sample Answer:
shift() moves values up or down by a specified number of rows.
It is useful for comparing current values with previous values.
Example:
df["previous_sales"] = df["sales"].shift(1)
df["sales_change"] = (
df["sales"] - df["previous_sales"]
)
8️⃣ What is resample() in Pandas?
Sample Answer:
resample() is used to group time-series data into different time frequencies, such as daily, weekly, or monthly.
Example:
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date")
monthly_sales = df["sales"].resample("MS").sum()
Here, `MS groups sales by month, starting at the beginning of each month.
**9️⃣ How do you calculate month-over-month sales growth?**
**Sample Answer:**
First, aggregate sales by month. Then use pct_change() to calculate the percentage change from the previous month.
Example:
``python
df["date"] = pd.to_datetime(df["date"])
monthly_sales = (
df.set_index("date")["sales"]
.resample("MS")
.sum()
)
monthly_sales_growth = monthly_sales.pct_change() * 100
This calculates the month-over-month percentage growth in sales. **🔟 How do you calculate the difference between the current and previous month's sales for each product?** **Sample Answer:** We can use `groupby()` with `shift()`. Example:python df = df.sort_values(["product", "month"]) df["previous_sales"] = ( df.groupby("product")["sales"].shift(1) ) df["sales_difference"] = ( df["sales"] - df["previous_sales"] )
`
This compares each product's sales with its previous recorded month.
📌 Double Tap ❤️ For More
