data(iris)

min_PL  <- min(iris$Petal.Length)
max_PL  <- max(iris$Petal.Length)
mean_PL <- mean(iris$Petal.Length)

min_PL
## [1] 1
max_PL
## [1] 6.9
mean_PL
## [1] 3.758
library(ggplot2)

ggplot(iris, aes(x = Species, y = Petal.Width)) +
  stat_summary(fun = mean, geom = "bar", fill = "skyblue") +
  labs(
    title = "Trung bình Petal.Width theo Species",
    x = "Species",
    y = "Mean Petal.Width"
  ) +
  theme_minimal()

import pandas as pd

df = pd.read_csv("iris.csv")
df.head()
##    sepal.length  sepal.width  petal.length  petal.width variety
## 0           5.1          3.5           1.4          0.2  Setosa
## 1           4.9          3.0           1.4          0.2  Setosa
## 2           4.7          3.2           1.3          0.2  Setosa
## 3           4.6          3.1           1.5          0.2  Setosa
## 4           5.0          3.6           1.4          0.2  Setosa
df_filtered = df[df["sepal.length"] > 6.0]
mean_petal_width = df_filtered["petal.width"].mean()
mean_petal_width
## np.float64(1.8475409836065577)