Skip to main content
added 190 characters in body
Source Link
bissi
  • 41
  • 6

I have a csv file called scenario1.csv in which the second column has column names like "0-4 years high risk", "65+ years first responder" etc. There are 20 such values. The 21st row, 2nd column has the same entry as in the 1st row of the 2nd column. I would like to rename these values to p1-p20 respectively. So the 21st row would have the p1 tag with it. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this? Below is an example for a shorter file:

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  1
.....,  .... 
0,  0-4 years low risk, 0,  0,   0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0
    .....,  .... 
   0,  p1,     0,  0,  0 

Here's the dictionary I need:

0-4 years first responder   p1
0-4 years high risk         p2
.......
65+ years low risk          p19
65+ years pregnant women    p20

I have a csv file called scenario1.csv in which the second column has column names like "0-4 years high risk", "65+ years first responder" etc. There are 20 such values. The 21st row, 2nd column has the same entry as in the 1st row of the 2nd column. I would like to rename these values to p1-p20 respectively. So the 21st row would have the p1 tag with it. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this? Below is an example for a shorter file:

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  1
.....,  .... 
0,  0-4 years low risk, 0,  0,   0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0
    .....,  .... 
   0,  p1,     0,  0,  0 

I have a csv file called scenario1.csv in which the second column has column names like "0-4 years high risk", "65+ years first responder" etc. There are 20 such values. The 21st row, 2nd column has the same entry as in the 1st row of the 2nd column. I would like to rename these values to p1-p20 respectively. So the 21st row would have the p1 tag with it. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this? Below is an example for a shorter file:

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  1
.....,  .... 
0,  0-4 years low risk, 0,  0,   0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0
    .....,  .... 
   0,  p1,     0,  0,  0 

Here's the dictionary I need:

0-4 years first responder   p1
0-4 years high risk         p2
.......
65+ years low risk          p19
65+ years pregnant women    p20
deleted 48 characters in body
Source Link
bissi
  • 41
  • 6

I have a csv file called scenario1.csv in which the second column has columnscolumn names like "0-4 years high risk", "65+ years first responder" etc. I want to change allThere are 20 such values. The 21st row, which only occur in2nd column 2has the same entry as in the entire sheet, to "p1". Then there are entries like "0-4 years low risk". This should be changed to "p2", and so on1st row of the 2nd column. I wantwould like to change this column two (the column header is "groups")rename these values to "p1" for "0-4 years low risk", "p2 for "0p1-4 years high risk" allp20 respectively. So the way up to p2021st row would have the p1 tag with it. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this? Below is an example for a shorter file:

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  1
.....,  .... 
0,  0-4 years low risk, 0,  0,   0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0
    .....,  .... 
   0,  p1,     0,  0,  0 

I have a csv file called scenario1.csv in which the second column has columns like "0-4 years high risk". I want to change all such values, which only occur in column 2 in the entire sheet, to "p1". Then there are entries like "0-4 years low risk". This should be changed to "p2", and so on. I want to change this column two (the column header is "groups") to "p1" for "0-4 years low risk", "p2 for "0-4 years high risk" all the way up to p20. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this?

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0

I have a csv file called scenario1.csv in which the second column has column names like "0-4 years high risk", "65+ years first responder" etc. There are 20 such values. The 21st row, 2nd column has the same entry as in the 1st row of the 2nd column. I would like to rename these values to p1-p20 respectively. So the 21st row would have the p1 tag with it. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this? Below is an example for a shorter file:

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  1
.....,  .... 
0,  0-4 years low risk, 0,  0,   0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0
    .....,  .... 
   0,  p1,     0,  0,  0 
added 24 characters in body
Source Link
bissi
  • 41
  • 6

I have a csv file called scenario1.csv in which the second column has columns like "0-4 years high risk". I want to change all such values, which only occur in column 2 in the entire sheet, to "p1". Then there are entries like "0-4 years low risk". This should be changed to "p2", and so on. I want to change this column two (the column header is "groups") to "p1" for "0-4 years low risk", "p2 for "0-4 years high risk" all the way up to p20. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this?

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0

I have a csv file called scenario1.csv in which the second column has columns like "0-4 years high risk". I want to change all such values, which only occur in column 2 in the entire sheet, to "p1". Then there are entries like "0-4 years low risk". This should be changed to "p2", and so on. I want to change this column two (the column header is "groups") to "p1" for "0-4 years low risk", "p2 for "0-4 years high risk" all the way up to p20. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this?

t  group               1  3  5
0  0-4 years low risk  0  0  0
0  0-4 years high risk 0  0  0

Expected output for each file:

   t  group  1  3  5
   0  p1     0  0  0
   0  p2     0  0  0

I have a csv file called scenario1.csv in which the second column has columns like "0-4 years high risk". I want to change all such values, which only occur in column 2 in the entire sheet, to "p1". Then there are entries like "0-4 years low risk". This should be changed to "p2", and so on. I want to change this column two (the column header is "groups") to "p1" for "0-4 years low risk", "p2 for "0-4 years high risk" all the way up to p20. Everything without quotes. I have a 150 such files, named scenario1.csv, scenario2.csv ... How do I do this?

t,  group,               1,  3,  5
0,  0-4 years low risk,  0,  0,  0
0,  0-4 years high risk, 0,  0,  0

Expected output for each file:

   t,  group,  1,  3,  5
   0,  p1,     0,  0,  0
   0,  p2,     0,  0,  0
deleted 41 characters in body
Source Link
bissi
  • 41
  • 6
Loading
added 39 characters in body
Source Link
bissi
  • 41
  • 6
Loading
added 137 characters in body
Source Link
bissi
  • 41
  • 6
Loading
Source Link
bissi
  • 41
  • 6
Loading