This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Trouble slicing a Pandas dataframe
Post Body

Howdy all,

So I’m learning to use Pandas and am trying to do some slicing in terms of columns.

I have a dataframe with about 100 columns, and I’d like to create a new one but with a specific column called “MeanCorrected_JH” in addition to every column from “Distance(km)” onwards.

I’ve tried using .loc but can’t seem to get the syntax correct for picking out a specific column plus a slice of others that are non adjacent.

If it helps, “Mean_Corrected_JH” is column index 4 and I want that plus 8 on (which I know [8:], I just can’t figure out how to combine to two syntactically)

Any guidance is muuuuch appreciated since this is for my thesis data

Author
Account Strength
90%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,742
Link Karma
937
Comment Karma
805
Profile updated: 1 day ago
Posts updated: 3 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago