[Your-Name-Here] - Fab Futures - Data Science
Home About
In [7]:
import pandas as pd

# Skip the first row which is the CSV title
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)

# Strip any extra spaces from column names
df.columns = df.columns.str.strip()

# Check columns
print(df.columns.tolist())
['Sl. No.', 'Name', 'Attendance', 'Topic', 'Exploration', 'Communication', 'Creativity', 'Any Additional Comment']
In [9]:
rating_map = {
    "Need improvement": 1,
    "Good": 2,
    "Very Good": 3
}

skills = ["Exploration", "Communication", "Creativity"]
for col in skills:
    df[col + "_score"] = df[col].map(rating_map)
In [10]:
x = np.arange(len(df))
npts = len(df)

plt.figure(figsize=(14,6))

colors = {"Exploration":"blue", "Communication":"green", "Creativity":"red"}

for skill in skills:
    y = df[skill + "_score"].values
    # Add small noise to simulate measurement variation
    y_noisy = y + np.random.normal(0, 0.05, npts)

    # Fit linear and quadratic models
    coeff1 = np.polyfit(x, y_noisy, 1)
    coeff2 = np.polyfit(x, y_noisy, 2)
    
    xfit = np.linspace(0, npts-1, npts)
    yfit1 = np.poly1d(coeff1)(xfit)
    yfit2 = np.poly1d(coeff2)(xfit)
    
    # Plot noisy data points
    plt.plot(x, y_noisy, 'o', color=colors[skill], alpha=0.6, label=f'{skill} scores')
    # Plot linear fit
    plt.plot(xfit, yfit1, '-', color=colors[skill], label=f'{skill} linear fit')
    # Plot quadratic fit
    plt.plot(xfit, yfit2, '--', color=colors[skill], label=f'{skill} quadratic fit')

plt.xticks(x, df["Name"], rotation=90)
plt.xlabel("Students")
plt.ylabel("Score (1-3)")
plt.title("Student Scores in Exploration, Communication, and Creativity")
plt.legend(bbox_to_anchor=(1.05,1), loc='upper left')
plt.tight_layout()
plt.show()
No description has been provided for this image
In [31]:
import pandas as pd
import plotly.express as px

# Load CSV
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# Map ratings
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
skills = ["Exploration", "Communication", "Creativity"]
for col in skills:
    df[col + "_score"] = df[col].map(rating_map)

# Create interactive 3D scatter plot
fig = px.scatter_3d(
    df,
    x="Exploration_score",
    y="Communication_score",
    z="Creativity_score",
    color="Creativity_score",
    color_continuous_scale="Viridis",
    size_max=12,
    opacity=1,
    hover_data={
        "Name": True,
        "Exploration_score": True,
        "Communication_score": True,
        "Creativity_score": True
    }
)

# Layout adjustments
fig.update_layout(
    scene=dict(
        xaxis_title='Exploration Score',
        yaxis_title='Communication Score',
        zaxis_title='Creativity Score',
        camera=dict(eye=dict(x=1.5, y=1.5, z=1.5))  # initial camera position
    ),
    title="Student Skill Scores (Interactive 3D Hover)"
)

fig.show()
No description has been provided for this image
In [35]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# --- Load CSV ---
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# --- Map ratings ---
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
skills = ["Exploration", "Communication", "Creativity"]
for col in skills:
    df[col + "_score"] = df[col].map(rating_map)

# --- Extract scores ---
x = df["Exploration_score"].values
y = df["Creativity_score"].values

# --- Scatter plot only ---
plt.figure(figsize=(10,6))
plt.scatter(x, y, c='blue', s=60, label='Student data', alpha=0.7)
plt.xlabel("Exploration Score")
plt.ylabel("Creativity Score")
plt.title("Exploration vs Creativity (Discrete Scores)")
plt.xticks([1,2,3])
plt.yticks([1,2,3])
plt.grid(True)
plt.legend()
plt.show()

# --- Optional: plot mean Creativity per Exploration to show trend ---
means = df.groupby("Exploration_score")["Creativity_score"].mean()
plt.figure(figsize=(10,6))
plt.scatter(x, y, c='blue', s=60, alpha=0.7, label='Student data')
plt.plot(means.index, means.values, 'r-o', label='Mean trend')
plt.xlabel("Exploration Score")
plt.ylabel("Creativity Score")
plt.title("Exploration vs Creativity with Mean Trend")
plt.xticks([1,2,3])
plt.yticks([1,2,3])
plt.grid(True)
plt.legend()
plt.show()
No description has been provided for this image
No description has been provided for this image
In [39]:
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go

# --- Load CSV ---
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# --- Map ratings to numeric scores ---
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
skills = ["Exploration", "Communication", "Creativity"]
for col in skills:
    df[col + "_score"] = df[col].map(rating_map)

# --- Create hover info ---
df['hover_text'] = df.apply(
    lambda row: f"Name: {row['Name']}<br>"
                f"Exploration: {row['Exploration_score']}<br>"
                f"Communication: {row['Communication_score']}<br>"
                f"Creativity: {row['Creativity_score']}", axis=1
)

# --- Scatter plot with hover ---
fig = px.scatter(
    df,
    x='Exploration_score',
    y='Creativity_score',
    text='Name',
    hover_name='Name',
    hover_data={'Exploration_score': True, 'Communication_score': True, 'Creativity_score': True, 'Name': False},
    color='Creativity_score',
    color_continuous_scale='Viridis',
    size_max=12
)

# --- Add mean trend line ---
means = df.groupby("Exploration_score")["Creativity_score"].mean().reset_index()
fig.add_trace(go.Scatter(
    x=means['Exploration_score'],
    y=means['Creativity_score'],
    mode='lines+markers',
    name='Mean trend',
    line=dict(color='red', width=3),
    marker=dict(size=8)
))

# --- Layout adjustments ---
fig.update_layout(
    title="Exploration vs Creativity (Interactive)",
    xaxis=dict(title="Exploration Score", tickvals=[1,2,3]),
    yaxis=dict(title="Creativity Score", tickvals=[1,2,3]),
    hovermode='closest'
)

fig.show()
No description has been provided for this image
In [43]:
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from scipy.interpolate import CubicSpline

# --- Load CSV ---
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# --- Map ratings ---
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
for col in ["Exploration", "Creativity"]:
    df[col + "_score"] = df[col].map(rating_map)

# --- Prepare hover text ---
df['hover_text'] = df.apply(
    lambda row: f"Name: {row['Name']}<br>"
                f"Exploration: {row['Exploration_score']}<br>"
                f"Creativity: {row['Creativity_score']}", axis=1
)

# --- Scatter points ---
scatter = go.Scatter(
    x=df["Exploration_score"],
    y=df["Creativity_score"],
    mode='markers',
    marker=dict(size=12, color='blue', opacity=0.7),
    hoverinfo='text',
    hovertext=df['hover_text'],
    name='Student data'
)

# --- Smooth trend line using mean + cubic spline ---
means = df.groupby("Exploration_score")["Creativity_score"].mean()
cs = CubicSpline(means.index, means.values)
xfit = np.linspace(1, 3, 100)
yfit = cs(xfit)

trend = go.Scatter(
    x=xfit,
    y=yfit,
    mode='lines',
    line=dict(color='red', width=3),
    name='Smooth trend'
)

# --- Layout ---
layout = go.Layout(
    title="Exploration vs Creativity (Interactive)",
    xaxis=dict(title="Exploration Score", tickvals=[1,2,3]),
    yaxis=dict(title="Creativity Score", tickvals=[1,2,3]),
    hovermode='closest'
)

# --- Create figure ---
fig = go.Figure(data=[scatter, trend], layout=layout)
fig.show()
No description has been provided for this image
In [48]:
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from scipy.interpolate import CubicSpline

# --- Load CSV ---
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# --- Map ratings ---
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
for col in ["Exploration", "Creativity"]:
    df[col + "_score"] = df[col].map(rating_map)

# --- Prepare hover text ---
df['hover_text'] = df.apply(
    lambda row: f"Name: {row['Name']}<br>"
                f"Exploration: {row['Exploration_score']}<br>"
                f"Creativity: {row['Creativity_score']}", axis=1
)

# --- Scatter points ---
scatter = go.Scatter(
    x=df["Exploration_score"],
    y=df["Creativity_score"],
    mode='markers',
    marker=dict(size=12, color='blue', opacity=0.7),
    hoverinfo='text',
    hovertext=df['hover_text'],
    name='Student data'
)

# --- Smooth trend line using mean + cubic spline ---
means = df.groupby("Exploration_score")["Creativity_score"].mean()
cs = CubicSpline(means.index, means.values)
xfit = np.linspace(1, 3, 100)
yfit = cs(xfit)

trend = go.Scatter(
    x=xfit,
    y=yfit,
    mode='lines',
    line=dict(color='red', width=3),
    name='Smooth trend'
)

# --- Layout ---
layout = go.Layout(
    title="Exploration vs Creativity (Interactive)",
    xaxis=dict(title="Exploration Score", tickvals=[1,2,3]),
    yaxis=dict(title="Creativity Score", tickvals=[1,2,3]),
    hovermode='closest'
)

# --- Create figure ---
fig = go.Figure(data=[scatter, trend], layout=layout)
fig.show()
No description has been provided for this image
In [54]:
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from scipy.interpolate import CubicSpline

# --- Load CSV ---
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# --- Map ratings ---
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
for col in ["Exploration", "Creativity"]:
    df[col + "_score"] = df[col].map(rating_map)

# --- x and y ---
x = df["Exploration_score"].values
y = df["Creativity_score"].values

# --- Jitter to avoid exact overlap ---
np.random.seed(10)
x_jitter = x + np.random.normal(0, 0.05, size=len(x))
y_jitter = y + np.random.normal(0, 0.05, size=len(y))

# --- Hover text ---
df['hover_text'] = df.apply(
    lambda r: f"Name: {r['Name']}<br>Exploration: {r['Exploration_score']}<br>Creativity: {r['Creativity_score']}",
    axis=1
)

# --- Scatter plot ---
scatter = go.Scatter(
    x=x_jitter,
    y=y_jitter,
    mode='markers',
    marker=dict(size=12, color='blue', opacity=0.7),
    hovertext=df['hover_text'],
    hoverinfo='text',
    name='Student data'
)

# --- Smooth trend with cubic spline ---
means = df.groupby("Exploration_score")["Creativity_score"].mean()
cs = CubicSpline(means.index, means.values)
xfit = np.linspace(1, 3, 100)
yfit = cs(xfit)

trend = go.Scatter(
    x=xfit,
    y=yfit,
    mode='lines',
    line=dict(color='red', width=3),
    name='Smooth trend'
)

# --- Layout ---
layout = go.Layout(
    title="Exploration vs Creativity",
    xaxis=dict(title="Exploration Score", tickvals=[1,2,3]),
    yaxis=dict(title="Creativity Score", tickvals=[1,2,3]),
    hovermode='closest'
)

fig = go.Figure(data=[scatter, trend], layout=layout)
fig.show()

axs[1].grid(True)

plt.tight_layout()
plt.show()
No description has been provided for this image
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[54], line 66
     63 fig = go.Figure(data=[scatter, trend], layout=layout)
     64 fig.show()
---> 66 axs[1].grid(True)
     68 plt.tight_layout()
     69 plt.show()

NameError: name 'axs' is not defined
In [59]:
import pandas as pd
import plotly.express as px

# Load CSV
df = pd.read_csv("Baselinedata_Grade VIII E..csv", skiprows=1)
df.columns = df.columns.str.strip()

# Map ratings to numeric for plotting
rating_map = {"Need improvement": 1, "Good": 2, "Very Good": 3}
df["Exploration_score"] = df["Exploration"].map(rating_map)
df["Creativity_score"] = df["Creativity"].map(rating_map)

# Slight jitter to avoid overlapping points
import numpy as np
np.random.seed(10)
df["x_jitter"] = df["Exploration_score"] + np.random.normal(0, 0.05, len(df))
df["y_jitter"] = df["Creativity_score"] + np.random.normal(0, 0.05, len(df))

# Plotly scatter
fig = px.scatter(
    df,
    x="x_jitter",
    y="y_jitter",
    text="Name",  # optional label near points
    hover_data=["Name", "Topic", "Exploration", "Communication", "Creativity", "Any Additional Comment"],
    title="Student Scores: Exploration vs Creativity",
    labels={"x_jitter": "Exploration Score", "y_jitter": "Creativity Score"}
)

fig.update_traces(marker=dict(size=12, color='skyblue', line=dict(width=1, color='DarkSlateGrey')))
fig.update_layout(xaxis=dict(tickvals=[1,2,3]), yaxis=dict(tickvals=[1,2,3]))
fig.show()
No description has been provided for this image
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: