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

  • SEARCH
  • Home
  • 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 6613771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:15:29+00:00 2026-05-25T20:15:29+00:00

I need to do some analysis on a large dataset from a hydrolgeology field

  • 0

I need to do some analysis on a large dataset from a hydrolgeology field work. I am using NumPy. I want to know how I can:

  1. multiply e.g. the 2nd column of my array by a number (e.g. 5.2). And then

  2. calculate the cumulative sum of the numbers in that column.

As I mentioned I only want to work on a specific column and not the whole array.

  • 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-05-25T20:15:30+00:00Added an answer on May 25, 2026 at 8:15 pm
     you can do this in two simple steps using NumPy:
    
    >>> # multiply column 2 of the 2D array, A, by 5.2
    >>> A[:,1] *= 5.2
    
    >>> # assuming by 'cumulative sum' you meant the 'reduced' sum:
    >>> A[:,1].sum()
    
    >>> # if in fact you want the cumulative sum (ie, returns a new column)
    >>> # then do this for the second step instead:
    >>> NP.cumsum(A[:,1])
    

    with some mocked data:

    >>> A = NP.random.rand(8, 5)
    >>> A
      array([[ 0.893,  0.824,  0.438,  0.284,  0.892],
             [ 0.534,  0.11 ,  0.409,  0.555,  0.96 ],
             [ 0.671,  0.817,  0.636,  0.522,  0.867],
             [ 0.752,  0.688,  0.142,  0.793,  0.716],
             [ 0.276,  0.818,  0.904,  0.767,  0.443],
             [ 0.57 ,  0.159,  0.144,  0.439,  0.747],
             [ 0.705,  0.793,  0.575,  0.507,  0.956],
             [ 0.322,  0.713,  0.963,  0.037,  0.509]])
    
    >>> A[:,1] *= 5.2
    
    >>> A
      array([[ 0.893,  4.287,  0.438,  0.284,  0.892],
             [ 0.534,  0.571,  0.409,  0.555,  0.96 ],
             [ 0.671,  4.25 ,  0.636,  0.522,  0.867],
             [ 0.752,  3.576,  0.142,  0.793,  0.716],
             [ 0.276,  4.255,  0.904,  0.767,  0.443],
             [ 0.57 ,  0.827,  0.144,  0.439,  0.747],
             [ 0.705,  4.122,  0.575,  0.507,  0.956],
             [ 0.322,  3.71 ,  0.963,  0.037,  0.509]])
    
    >>> A[:,1].sum()
      25.596156138451427
    

    just a few simple rules are required to grok element selection (indexing) in NumPy:

    • NumPy, like Python, is 0-based, so eg, the “1” below refers to the second column

    • commas separate the dimensions inside the brackets, so [rows, columns], eg, A[2,3] means the item (“cell”) at row three, column four

    • a colon means all of the elements along that dimension, eg, A[:,1] creates a view of A’s column 2; A[3,:] refers to the fourth row

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to do some analysis on some old code and need to be
I'm using clang 3.0 library for some analysis of C/C++ code, and I need
I am using Python and Numpy to do some data analysis. I have a
I need to analysis some x86 dump file, So I want to install the
I'm doing some specific signal analysis, and I am in need of a method
Need some help about with Memcache. I have created a class and want to
Need some guidance figuring out what went wrong. I've been using mysql, phpmyadmin for
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
I have some large MySQL production tables that I need to dump so that
I'm working on an application with statistic analysis, and I need some help. Given

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.