Python equivalent R code, some nuance concerning RStudio cross-posted from: programming.dev/post/8025145...