A data analysis dashboard is a visual display of key performance indicators (KPIs) and data analytics, designed to provide at-a-glance insights into the current state or performance of a business, project, or system. Dashboards typically aggregate data from various sources, process it, and present it through charts, graphs, tables, and other interactive elements.
NumPy (Numerical Python) is a fundamental package for numerical computing in Python. While NumPy itself doesn't directly build interactive dashboard elements, it is an indispensable foundational library for the 'Veri Analizi' (Data Analysis) part of a dashboard. Its core contributions include:
1. Efficient Data Storage and Manipulation: NumPy's `ndarray` object is a powerful N-dimensional array that allows for efficient storage and manipulation of large datasets. This is crucial for handling the raw data that feeds into any dashboard.
2. Vectorized Operations: NumPy enables vectorized operations, meaning operations are applied to entire arrays rather than individual elements using explicit loops. This significantly speeds up numerical computations, which is vital when processing large amounts of data for dashboard visualizations.
3. Mathematical and Statistical Functions: It provides a vast collection of high-level mathematical functions to operate on these arrays, including linear algebra routines, Fourier transforms, random number generation, and various statistical functions (mean, median, standard deviation, correlation, etc.). These are essential for calculating the metrics and statistics displayed on a dashboard.
4. Integration with Other Libraries: NumPy forms the bedrock for many other scientific computing libraries in Python, such as Pandas (for structured data), Matplotlib and Seaborn (for static visualizations), and Scikit-learn (for machine learning). In the context of dashboards, NumPy arrays often serve as the input for plotting libraries to generate the visual components.
In essence, NumPy provides the computational horsepower for processing, transforming, and summarizing the data before it is handed over to visualization libraries to create the dashboard's graphical elements. It helps in preparing the data, deriving insights (like trends, aggregates, distributions), and performing any necessary numerical transformations that empower the dashboard's analytical capabilities.
Example Code
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd Often used with numpy for structured data
--- 1. Veri Üretimi (Data Generation) using NumPy ---
Let's simulate some sales data over a period
days = np.arange(1, 31) 30 days
sales_base = 100 + 10 - np.sin(np.linspace(0, 3 - np.pi, 30)) Seasonal trend
noise = np.random.normal(0, 15, 30) Random fluctuations
sales_data = np.maximum(0, (sales_base + noise)).astype(int) Ensure non-negative sales
Another metric: customer satisfaction scores (out of 100)
customer_satisfaction = np.random.randint(60, 100, 30)
--- 2. NumPy ile Veri Analizi ve İşleme (Data Analysis and Processing with NumPy) ---
Toplam Satış (Total Sales)
total_sales = np.sum(sales_data)
Ortalama Günlük Satış (Average Daily Sales)
avg_daily_sales = np.mean(sales_data)
Satış Standart Sapması (Standard Deviation of Sales - volatility)
sales_std_dev = np.std(sales_data)
Kümülatif Satışlar (Cumulative Sales - often useful for trends)
cumulative_sales = np.cumsum(sales_data)
Haftalık Ortalamalar (Weekly Averages - Example of data aggregation)
Assuming a 5-day week for simplicity (e.g., business days)
We'll pad with NaNs if the data length isn't a perfect multiple of 5
weekly_sales_padded = np.pad(sales_data.astype(float), (0, 5 - (len(sales_data) % 5) if len(sales_data) % 5 != 0 else 0), mode='constant', constant_values=np.nan)
weekly_avg_sales = np.nanmean(weekly_sales_padded.reshape(-1, 5), axis=1)
Müşteri Memnuniyeti Ortalaması (Average Customer Satisfaction)
avg_satisfaction = np.mean(customer_satisfaction)
--- 3. Dashboard için Veri Hazırlığı ve Görselleştirme (Data Preparation for Dashboard and Visualization) ---
Use Matplotlib to simulate simple dashboard components
fig, axes = plt.subplots(3, 1, figsize=(12, 18))
fig.suptitle('Simulated Daily Sales and Customer Satisfaction Dashboard', fontsize=16)
Panel 1: Günlük ve Kümülatif Satışlar (Daily and Cumulative Sales)
axes[0].plot(days, sales_data, marker='o', linestyle='-', color='skyblue', label='Daily Sales')
axes[0].plot(days, cumulative_sales, marker='x', linestyle='--', color='salmon', label='Cumulative Sales')
axes[0].set_title('Daily and Cumulative Sales Over 30 Days')
axes[0].set_xlabel('Day')
axes[0].set_ylabel('Sales Units')
axes[0].grid(True)
axes[0].legend()
Panel 2: Temel Satış Metrikleri (Key Sales Metrics)
metrics_labels = ['Total Sales', 'Avg. Daily Sales', 'Sales Std. Dev.']
metrics_values = [total_sales, avg_daily_sales, sales_std_dev]
Displaying as text, could also be bar charts for comparison
axes[1].bar(metrics_labels, metrics_values, color=['green', 'blue', 'orange'])
axes[1].set_title('Key Sales Performance Indicators')
axes[1].set_ylabel('Value')
axes[1].grid(axis='y')
for i, v in enumerate(metrics_values):
axes[1].text(i, v + 5, f'{v:.2f}', ha='center', va='bottom', fontsize=10)
Panel 3: Müşteri Memnuniyeti Dağılımı ve Ortalaması (Customer Satisfaction Distribution and Average)
axes[2].hist(customer_satisfaction, bins=5, color='purple', alpha=0.7, label='Satisfaction Score Distribution')
axes[2].axvline(avg_satisfaction, color='red', linestyle='dashed', linewidth=2, label=f'Avg. Satisfaction: {avg_satisfaction:.2f}')
axes[2].set_title('Customer Satisfaction Scores and Average')
axes[2].set_xlabel('Satisfaction Score')
axes[2].set_ylabel('Frequency')
axes[2].grid(axis='y')
axes[2].legend()
plt.tight_layout(rect=[0, 0.03, 1, 0.96]) Adjust layout to prevent title overlap
plt.show()
print(f"\nDashboard Summary Figures:")
print(f" Total Sales: {total_sales}")
print(f" Average Daily Sales: {avg_daily_sales:.2f}")
print(f" Sales Standard Deviation: {sales_std_dev:.2f}")
print(f" Average Customer Satisfaction: {avg_satisfaction:.2f}")
print(f" Weekly Average Sales: {weekly_avg_sales.round(2)}")








Data Analysis Dashboard with NumPy