Python Numpy/Scipy help - 2D Table Generation

Man of Honour
Joined
13 Nov 2009
Posts
11,595
Location
Northampton
Spent some time looking at Numpy for this but I'm totally lost on the method of achieving the result I'm looking for. Coding itself isn't the issue.

And hopefully I can explain this in a way someone can understand...

  • The end result should be a 2d table/array.
  • X-axis of the table/array are pre-defined bins/values
  • The Y-axis should be populated with an average value as read from the input CSV file
  • Y-axis values need to be interpolated between the bins
 
Caporegime
Joined
29 Jan 2008
Posts
58,899
It isn't quite clear what the issue is here - what have you attempted and where are you getting stuck?

So you want an array to contain some average values - presumably the mean of some values read from the csv file. Each column in the array represents a different value of your independent variable x and presumably is populated with this average of your dependent variable y value in one of the rows and the x values in the other row? So you want an array with two rows and however many columns you need for the x values?

Now you mention interpolation - are you looking to plot the data or is it that for some of the x values you need for the table are you missing corresponding y values? There are a a bunch of interpolation methods available in scipy - though the question of which to use isn't really a programming one.

Where are you actually getting stuck here - creating the array? Calculating an average/mean y value for each x? (Plotting data? if appropriate) Interpolation?
 
Man of Honour
OP
Joined
13 Nov 2009
Posts
11,595
Location
Northampton
It isn't quite clear what the issue is here - what have you attempted and where are you getting stuck?

So you want an array to contain some average values - presumably the mean of some values read from the csv file. Each column in the array represents a different value of your independent variable x and presumably is populated with this average of your dependent variable y value in one of the rows and the x values in the other row? So you want an array with two rows and however many columns you need for the x values?

Now you mention interpolation - are you looking to plot the data or is it that for some of the x values you need for the table are you missing corresponding y values? There are a a bunch of interpolation methods available in scipy - though the question of which to use isn't really a programming one.

Where are you actually getting stuck here - creating the array? Calculating an average/mean y value for each x? (Plotting data? if appropriate) Interpolation?

I'm struggling knowing where to start at all

The CSV file will contain Data Points A & B, I then want to generate a list of averages of Data point B for specific values for Data point A.

Generating averages is easy enough to do, but I need to limit the resulting output from potentially 1000 values for Data point A down to a specific set of limited values (32-64)

And while typing this out I think I have just figured it out
 
Caporegime
Joined
29 Jan 2008
Posts
58,899
Ah, that's always nice, leave a problem for a couple of days then when you come back to it and think through it again something just clicks... glad you've got it solved now :)
 
Associate
Joined
10 Nov 2013
Posts
1,804
Rubber ducking - it's very common to find the solution to a problem whilst trying to explain the problem to someone else :)
 
Back
Top Bottom