question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

slicing within `select()`

See original GitHub issue

Is it possible to slice with the select() verb?

For example, suppose I have a dataframe

df = pd.DataFrame({"a": range(3), "x" : range(3), 
                   "y": range(3), "z": range(3)}, 
                   index=range(3))

I can do this

df >> select("x", "y", "z")

Is it possible in someway to do this via a slice "x":"z"? I tried

edited

df >> select("x":"z") #corrected typo here "z" was "y"

and

edited

df >> select(("x":"z")) # corrected typo here "z" was "y"

with no success.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
has2k1commented, Nov 26, 2017

I see the confusion. I mean, plydata implementing the slice function so that you (the user) can use it to select columns. It is not possible now, but it is good feature. I’ll add it may be tomorrow and make a release.

0reactions
has2k1commented, Nov 27, 2017

Released in v0.3.2. You can now do select(..., slice("x", "y"), ...).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indexing, Slicing and Subsetting DataFrames in Python
Employ slicing to select sets of data from a DataFrame. ... In contrast, the copy() method for a DataFrame creates a true copy...
Read more >
Subset rows using their positions — slice • dplyr
slice() lets you index rows by their (integer) locations. It allows you to select, remove, and duplicate rows. It is accompanied by a...
Read more >
How to select every other using slicing in Python
First element 1 means you want to slice the element starting from its second element. The last element 2 is the interval (every...
Read more >
slice: Subset rows using their positions in dplyr - Rdrr.io
slice() lets you index rows by their (integer) locations. It allows you to select, remove, and duplicate rows. It is accompanied by a...
Read more >
How to Slice Columns in pandas DataFrame
In this article, I will explain how to slice/take or select a subset of a DataFrame by column labels, certain positions of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found