Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 493

Python: Generate range of values for groupby values

$
0
0

I am trying to generate test data using python. Let me know if i can achieve something like this.I will input a number, say 20, i need 20 value of rows to be generated. one column contains range of values for each of the group. Values should be generated within that range. (some doesnt have range of values and can be skipped) Sample input and expected output below.

Sample input:

  VarName           Label  Score0    LtoV  0.00<=to>=0.68     201    LtoV     0.69<=to>=2     332    LtoV         2toHigh     403     Age           0to20     364     Age          21to40     155     Age          41to60     50

Output:

when i give value as 20, i need 20 rows to be generated for LtoV with column2 having any values between 0.00 to high and based on the value the corresponding scores should be given.Sameway 20 rows for age also.

SNo    VarName    column2     Score  1       LtoV       0.00        20       2       LtoV       0.42        20  3       LtoV       1           33  4       LtoV       2.5         40... 20       LtoV      50           40

generate 20 such values for LtoV and 20 such values for Age and based on the range corresponding value for score.Is this feasible?



Viewing all articles
Browse latest Browse all 493

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>