Last active
March 17, 2022 18:50
-
-
Save TomAugspurger/6e052140eaa5fdb6e8c0 to your computer and use it in GitHub Desktop.
For those who are struggling to translate your R code into python, you might want to take a look at this package:
https://github.com/pwwang/datar
which reimages pandas APIs and aligns them with tidyverse's.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wonderful notebook! Helps me know R better. There might be something that will help others know pandas better.
Anyway, as in
In[8]
,flights.iloc[:9]
is fine. But wouldn'tflights.loc[:10]
be more equivalent?And
In[12]
:I'm only guessing what the R code does, but how about
flights.loc[:, 'year':'day']
? And if there's a list of columns to get, namedcolumns
for example, I thinkflights[columns]
will do, other than__getitem__ ([])
.And
In[13]
:If I'm guessing right,
flights.loc[:, ~flight.columns.isin(a.loc[:, 'year':'day'])]
might do. But it's a little bit tedious and less elegant than R.Again, a very helpful notebook.