Data Visualization Lab: Experiment 1
Data Visualization Lab: Experiment 1
24PDD0021
SCOPE
Experiment 1:
Create a dataset of 20 rows and 10 columns of data associated with any of your
interested domains. The dataset shall include data of types: Qualitative and
Code:
import pandas as pd
import numpy as np
np.random.seed(42)
data = {
# Create DataFrame
df = pd.DataFrame(data)
plt.figure(figsize=(10, 6))
plt.xlabel('Department')
plt.ylabel('Count')
plt.show()
# b. Numerical Data across more than one categorical data (e.g., Salary vs Department with
Job Level as Hue)
plt.figure(figsize=(10, 6))
plt.xlabel('Department')
plt.ylabel('Salary (USD)')
plt.show()
df['Age Group'] = pd.cut(df['Age'], bins=[20, 30, 40, 50, 60], labels=['20-30', '30-40', '40-50',
'50-60'])
plt.figure(figsize=(10, 6))
plt.xlabel('Age Group')
plt.ylabel('Performance Score')
plt.show()
Output:
Experiment 5:
Create a dataset of 20 rows and 10 columns of data associated with any of your
interested domains. The dataset shall include data of types: Qualitative and
Code:
import pandas as pd
import numpy as np
np.random.seed(42)
data = {
# Create DataFrame
df = pd.DataFrame(data)
# We'll plot Transaction Amount and Discount Applied over the Transaction Date.
plt.figure(figsize=(10, 6))
plt.xlabel('Date')
plt.ylabel('Value')
plt.legend()
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
plt.xlabel('Product Category')
plt.ylabel('Count')
plt.show()
plt.figure(figsize=(10, 6))
plt.xlabel('Payment Method')
plt.ylabel('Customer Satisfaction')
plt.show()
Output: