#câu 1 #Tính min, max
mydata <- iris
min_PL <- min(iris$Petal.Length)
max_PL <- max(iris$Petal.Length)
mean_PL <- mean(iris$Petal.Length)
#ve bieu do cot
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"
)
#Câu 2
#Đọc file dữ liệu
#library("reticulate")
import pandas as pd
df = pd.read_csv("iris.csv")
#lọc các dòng
df_filtered = df[df["sepal.length"] > 6.0]
#Tính trung bình
mean_petal_width = df_filtered["petal.width"].mean()
print(f"Giá trị trung bình của petal_width: {mean_petal_width}")
## Giá trị trung bình của petal_width: 1.8475409836065577