Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8573729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:19:02+00:00 2026-06-11T19:19:02+00:00

I have a dataframe in python pandas with several columns taken from a CSV

  • 0

I have a dataframe in python pandas with several columns taken from a CSV file.

For instance, data =:

Day P1S1 P1S2 P1S3 P2S1 P2S2 P2S3
1   1    2    2    3    1    2
2   2    2    3    5    4    2

And what I need is to get the sum of all columns which name starts with P1… something like P1* with a wildcard.

Something like the following which gives an error:

P1Sum = data[“P1*”]

Is there any why to do this with pandas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:19:03+00:00Added an answer on June 11, 2026 at 7:19 pm

    I found the answer.

    Using the data, dataframe from the question:

    from pandas import *
    
    P1Channels = data.filter(regex="P1")
    P1Sum = P1Channels.sum(axis=1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataframe in R that I loaded from a CSV file. One
I have a dataframe (14.5K rows by 15 columns) containing billing data from 2001
I have a dataframe generated from Python's Pandas package. How can I generate heatmap
I have a Python pandas DataFrame rpt : rpt <class 'pandas.core.frame.DataFrame'> MultiIndex: 47518 entries,
I have a dataframe with distances df<-data.frame(site.x=c(A,A,A,B,B,C), site.y=c(B,C,D,C,D,D),Distance=c(67,57,64,60,67,60)) I need to convert this to
I have a dataframe with some numeric columns. Some row has a 0 value
I have a dataframe with over 200 columns. The issue is as they were
I have a dataframe called split2_data (actually a drop-leveled subset of a bigger data
I have a dataframe with numeric entries like this one test <- data.frame(x =
I have a dataframe called data where I would like to rescale the values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.