我目前正在学习pandas,我之前对R/dplyr/tidyverse很熟悉。
pandas的API并不是那么直观易用,我该如何使用pandas语法优雅地重写dplyr中的操作?
library("nycflights13")
library("tidyverse")
delays <- flights %>%
group_by(dest) %>%
summarize(
count = n(),
dist = mean(distance, na.rm = TRUE),
delay = mean(arr_delay, na.rm = TRUE)
) %>%
filter(count > 20, dest != "HNL")