Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gepcel

This comment has been minimized.

Copy link

commented Dec 28, 2014

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't flights.loc[:10] be more equivalent?

And In[12]:

# select(flights, year:day) 

# No real equivalent here. Although I think this is OK.
# Typically I'll have the columns I want stored in a list
# somewhere, which can be passed right into __getitem__ ([]).

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, named columns for example, I think flights[columns] will do, other than __getitem__ ([]).

And In[13]:

# select(flights, -(year:day)) 
...

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.