I would like to download the 10-year federal note yield from the treasury website: https://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield
To parse the above webpage and retrieve the most recent 10 yr treasury note yield, I used to follow the instructions provided here:
Parsing 10-year federal note yield from the website
library(httr)
URL = "https://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield"
urldata <- GET(URL)
data <- readHTMLTable(rawToChar(urldata$content),
stringsAsFactors = FALSE)
data <- as.data.frame((data[69]))
names(data) <- gsub("NULL.","", names(data)) # Take out "NULL."
But it no longer works.
Any thoughts what may be wrong or alternative suggestions?
This does not answer the specific question of why your code no longer works. Here is an alternative using rvest package which simplifies many scraping operations. In particular below, the selection of the table is made with the class id CSS selector .t-chart. This makes it much more tolerant of page formatting changes. The chaining with operator %>% makes for very compact code.
library(rvest)
t_url = "https://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield"
rates <- read_html(t_url) %>%
html_node(".t-chart") %>%
html_table()
rates
# Date 1 mo 3 mo 6 mo 1 yr 2 yr 3 yr 5 yr 7 yr 10 yr 20 yr 30 yr
# 1 04/03/17 0.73 0.79 0.92 1.02 1.24 1.47 1.88 2.16 2.35 2.71 2.98
# 2 04/04/17 0.77 0.79 0.92 1.03 1.25 1.47 1.88 2.16 2.36 2.72 2.99
# 3 04/05/17 0.77 0.80 0.93 1.03 1.24 1.44 1.85 2.14 2.34 2.71 2.98
# 4 04/06/17 0.78 0.79 0.94 1.05 1.24 1.45 1.87 2.15 2.34 2.72 2.99
# 5 04/07/17 0.77 0.82 0.95 1.08 1.29 1.52 1.92 2.20 2.38 2.74 3.00
# 6 04/10/17 0.77 0.82 0.97 1.07 1.29 1.52 1.91 2.18 2.37 2.72 2.99
# 7 04/11/17 0.74 0.82 0.94 1.05 1.24 1.45 1.84 2.11 2.32 2.67 2.93
# 8 04/12/17 0.77 0.81 0.95 1.04 1.24 1.44 1.81 2.09 2.28 2.65 2.92
# 9 04/13/17 0.76 0.81 0.94 1.03 1.21 1.40 1.77 2.05 2.24 2.62 2.89
Related
So I am trying to get a table off of https://www.baseball-reference.com/register/team.cgi?id=9995d2a1, specifically the one labeled "Team Pitching", which is hidden in an html comment, preventing me from using pd.read_html() or another simpler method. I have gotten to the point where I have all of the data in a data frame, but my issue is that players with an asterisk in their name because they are left handed dissapear. Meaning their names turn to 'None', but I really need to remove the '*' so that the name reads.
This is what I did to get what I have so far with the 'None' as a name for lefties:
page = BeautifulSoup(requests.get('https://www.baseball-reference.com/register/team.cgi?id=b0a9f9bc').text, features = 'lxml')
tbls = []
for comment in page.find_all(text=lambda text: isinstance(text, Comment)):
if comment.find("<table ") > 0:
comment_soup = BeautifulSoup(comment, 'lxml')
table = comment_soup.find("table")
tbls.append(table)
def parse_row(row):
return [str(x.string) for x in row.find_all('td')]
# pitching table
pitching_tbl = tbls[0]
# html text only used for finding names
html = BeautifulSoup(pitching_tbl.text, features = 'lxml')
rows = pitching_tbl.find_all('tr')
data = pd.DataFrame([parse_row(row) for row in rows])
What I would like to be able to do is loop through the text within the pitching_tbl text, and change it in place if there is an asterisk and use .replace('*', ''), and have the actual html within pitching_tbl be changed.
any help is appriciated!
The desired table data is in html comment.So You can invoke beautifulsoup built-in package which is Comment with lambda function to grab data.
import pandas as pd
import requests
from bs4 import BeautifulSoup
from bs4 import Comment
url='https://www.baseball-reference.com/register/team.cgi?id=9995d2a1'
req=requests.get(url)
soup=BeautifulSoup(req.text,'lxml')
df = pd.read_html([x for x in soup.find_all(string=lambda text: isinstance(text, Comment)) if 'id="div_team_pitching"' in x][0])[0]
print(df)
Output:
Rk Name Age W L W-L% ... H9 HR9 BB9 SO9 SO/W Notes
0 1.0 Logan Bursick-Harrington 21.0 0 2 0.000 ... 4.5 0.0 15.8 15.8 1.00 NaN
1 2.0 Cylis Cox* 19.0 1 0 1.000 ... 23.1 0.0 7.7 11.6 1.50 NaN
2 3.0 Travis Densmore* 21.0 0 1 0.000 ... 7.2 0.0 1.8 14.4 8.00 NaN
3 4.0 Dylan Freeman 22.0 1 0 1.000 ... 13.5 1.1 3.4 14.6 4.33 NaN
4 5.0 Zach Hopman* 22.0 0 1 0.000 ... 12.8 0.0 9.9 11.4 1.14 NaN
5 6.0 Eamon Horwedel 22.0 1 0 1.000 ... 9.0 0.0 6.4 6.4 1.00 NaN
6 7.0 Tyler Johnson 19.0 0 0 NaN ... 5.4 0.0 2.7 10.8 4.00 NaN
7 8.0 Trent Jones 20.0 0 0 NaN ... 14.6 1.1 2.3 12.4 5.50 NaN
8 9.0 Tanner Knapp 21.0 1 1 0.500 ... 11.6 0.0 7.7 4.8 0.63 NaN
9 10.0 Mason Majors 22.0 1 0 1.000 ... 4.9 0.0 7.4 12.3 1.67 NaN
10 11.0 Mason Meeks 21.0 0 1 0.000 ... 6.3 0.9 3.6 5.4 1.50 NaN
11 12.0 Sam Nagelvoort 19.0 0 1 0.000 ... 18.0 2.3 22.5 9.0 0.40 NaN
12 13.0 Tyler Nichol 20.0 0 0 NaN ... 27.0 0.0 27.0 0.0 0.00 NaN
13 14.0 Cole Russo 19.0 0 0 NaN ... 27.0 13.5 0.0 0.0 NaN NaN
14 15.0 Kyle Salley* 22.0 0 1 0.000 ... 9.0 2.3 22.5 9.0 0.40 NaN
15 16.0 Noah Stants 21.0 0 0 NaN ... 4.3 1.4 7.1 11.4 1.60 NaN
16 17.0 Quinn Waterhouse* 21.0 0 0 NaN ... 4.5 0.0 4.5 18.0 4.00 NaN
17 18.0 Nick Weyrich 19.0 0 0 NaN ... 6.4 1.3 7.7 11.6 1.50 NaN
18 19.0 Adam Wheaton 23.0 0 1 0.000 ... 11.7 1.8 4.5 12.6 2.80 NaN
19 NaN 19 Players 20.9 5 9 0.357 ... 9.2 0.8 6.9 10.7 1.55 NaN
[20 rows x 32 columns]
So to get that, you need to change:
def parse_row(row):
return [str(x.string) for x in row.find_all('td')]
to
def parse_row(row):
return [str(x.text) for x in row.find_all('td')]
The reason you get None is because the '*' is not part of the <a> tag, so essentially there are 2 contents within the <td> element. If you use .text it'll join them.
So that handles the first issue of the None. The second issue of removing the *: I'm not sure do you actually want it removed from the html, or just simply removed in the dataframe you create, so I will show you both.
To change the actual html:
Here we just remove the '*' element from the <td> .contents list. This will alter the actual soup object, changing the html. And this will also then result in your dataframe showing without that too.
HTML Before:
HTML After - Notice the '*' no longer in the actual html:
Now if you're not interested in changing the html, but rather just grab the data and use pandas to manipulate (NOTE: like F.Hoque did, I would let pandas' .read_html() parse the table for you as it'll grab the headers as well, but this will still work with your code too. Either way, it would be the last step once you have data or in the other solution df. For his, you'd do df['Name'] = df['Name'].str.replace('*','', regex=True)):
import requests
from bs4 import BeautifulSoup, Comment
import pandas as pd
page = BeautifulSoup(requests.get('https://www.baseball-reference.com/register/team.cgi?id=b0a9f9bc').text, features = 'lxml')
tbls = []
for comment in page.find_all(text=lambda text: isinstance(text, Comment)):
if comment.find("<table ") > 0:
comment_soup = BeautifulSoup(comment, 'lxml')
table = comment_soup.find("table")
tbls.append(table)
def parse_row(row):
return [str(x.text) for x in row.find_all('td')]
# pitching table
pitching_tbl = tbls[0]
# html text only used for finding names
html = BeautifulSoup(pitching_tbl.text, features = 'lxml')
rows = pitching_tbl.find_all('tr')
data = pd.DataFrame([parse_row(row) for row in rows])
data[0] = data[0].str.replace('*','', regex=True)
**Using F.Hoque's solution, which is how I would do it. And then also, that might be nice extra column to add, so if it's there, why not add it?:
import pandas as pd
import requests
from bs4 import BeautifulSoup, Comment
import numpy as np
url='https://www.baseball-reference.com/register/team.cgi?id=9995d2a1'
req=requests.get(url)
soup=BeautifulSoup(req.text,'lxml')
df = pd.read_html([x for x in soup.find_all(string=lambda text: isinstance(text, Comment)) if 'id="div_team_pitching"' in x][0])[0]
df['Handedness'] = np.where(df['Name'].str.contains('\*'), 'L', 'R')
df['Name'] = df['Name'].str.replace('*','', regex=True)
print(df)
Output:
Rk Name Age W ... SO9 SO/W Notes Handedness
0 1.0 Logan Bursick-Harrington 21.0 0 ... 15.8 1.00 NaN R
1 2.0 Cylis Cox 19.0 1 ... 11.6 1.50 NaN L
2 3.0 Travis Densmore 21.0 0 ... 14.4 8.00 NaN L
3 4.0 Dylan Freeman 22.0 1 ... 14.6 4.33 NaN R
4 5.0 Zach Hopman 22.0 0 ... 11.4 1.14 NaN L
5 6.0 Eamon Horwedel 22.0 1 ... 6.4 1.00 NaN R
6 7.0 Tyler Johnson 19.0 0 ... 10.8 4.00 NaN R
7 8.0 Trent Jones 20.0 0 ... 12.4 5.50 NaN R
8 9.0 Tanner Knapp 21.0 1 ... 4.8 0.63 NaN R
9 10.0 Mason Majors 22.0 1 ... 12.3 1.67 NaN R
10 11.0 Mason Meeks 21.0 0 ... 5.4 1.50 NaN R
11 12.0 Sam Nagelvoort 19.0 0 ... 9.0 0.40 NaN R
12 13.0 Tyler Nichol 20.0 0 ... 0.0 0.00 NaN R
13 14.0 Cole Russo 19.0 0 ... 0.0 NaN NaN R
14 15.0 Kyle Salley 22.0 0 ... 9.0 0.40 NaN L
15 16.0 Noah Stants 21.0 0 ... 11.4 1.60 NaN R
16 17.0 Quinn Waterhouse 21.0 0 ... 18.0 4.00 NaN L
17 18.0 Nick Weyrich 19.0 0 ... 11.6 1.50 NaN R
18 19.0 Adam Wheaton 23.0 0 ... 12.6 2.80 NaN R
19 NaN 19 Players 20.9 5 ... 10.7 1.55 NaN R
[20 rows x 33 columns]
I have the following html
<table id="statTableHTML" class="table hidden"><thead><tr><th>Characteristic</th><th>GCI Score</th><th>Legal</th><th>Technical</th><th>Organizational</th><th>Capacity Building</th><th>Cooperation</th></tr></thead><tbody><tr><td>United Kingdom</td><td>0.93</td><td>0.2</td><td>0.19</td><td>0.2</td><td>0.19</td><td>0.15</td></tr><tr><td>United States</td><td>0.93</td><td>0.2</td><td>0.18</td><td>0.2</td><td>0.19</td><td>0.15</td></tr><tr><td>France</td><td>0.92</td><td>0.2</td><td>0.19</td><td>0.2</td><td>0.19</td><td>0.14</td></tr><tr><td>Lithuania</td><td>0.91</td><td>0.2</td><td>0.17</td><td>0.2</td><td>0.19</td><td>0.16</td></tr><tr><td>Estonia</td><td>0.91</td><td>0.2</td><td>0.2</td><td>0.19</td><td>0.17</td><td>0.15</td></tr><tr><td>Singapore</td><td>0.9</td><td>0.2</td><td>0.19</td><td>0.19</td><td>0.2</td><td>0.13</td></tr><tr><td>Spain</td><td>0.9</td><td>0.2</td><td>0.18</td><td>0.2</td><td>0.17</td><td>0.15</td></tr><tr><td>Malaysia</td><td>0.89</td><td>0.18</td><td>0.2</td><td>0.2</td><td>0.2</td><td>0.12</td></tr><tr><td>Norway</td><td>0.89</td><td>0.19</td><td>0.2</td><td>0.18</td><td>0.19</td><td>0.14</td></tr><tr><td>Canada</td><td>0.89</td><td>0.2</td><td>0.19</td><td>0.2</td><td>0.17</td><td>0.14</td></tr><tr><td>Australia</td><td>0.89</td><td>0.2</td><td>0.17</td><td>0.2</td><td>0.18</td><td>0.14</td></tr></tbody></table>
I would like to get all the values within the tr, td elements.
I have the following
awk -F '</*td>|</*tr>' '{print $5, $7, $9, $11, $13, $15, $17}'
however it only outputs the first row
United Kingdom 0.93 0.2 0.19 0.2 0.19 0.15
how can i write this so I get all the values of the rows?
thanks
With GNU awk for multi-char RS:
$ awk -v RS='<tr><td>|</td></tr>' -F'(</?td>)+' -v OFS='\t' 'NF>1{$1=$1; print}' file
United Kingdom 0.93 0.2 0.19 0.2 0.19 0.15
United States 0.93 0.2 0.18 0.2 0.19 0.15
France 0.92 0.2 0.19 0.2 0.19 0.14
Lithuania 0.91 0.2 0.17 0.2 0.19 0.16
Estonia 0.91 0.2 0.2 0.19 0.17 0.15
Singapore 0.9 0.2 0.19 0.19 0.2 0.13
Spain 0.9 0.2 0.18 0.2 0.17 0.15
Malaysia 0.89 0.18 0.2 0.2 0.2 0.12
Norway 0.89 0.19 0.2 0.18 0.19 0.14
Canada 0.89 0.2 0.19 0.2 0.17 0.14
Australia 0.89 0.2 0.17 0.2 0.18 0.14
or if you prefer tabular instead of tab-separated output just pipe it to column:
$ awk -v RS='<tr><td>|</td></tr>' -F'(</?td>)+' -v OFS='\t' 'NF>1{$1=$1; print}' file | column -s$'\t' -t
United Kingdom 0.93 0.2 0.19 0.2 0.19 0.15
United States 0.93 0.2 0.18 0.2 0.19 0.15
France 0.92 0.2 0.19 0.2 0.19 0.14
Lithuania 0.91 0.2 0.17 0.2 0.19 0.16
Estonia 0.91 0.2 0.2 0.19 0.17 0.15
Singapore 0.9 0.2 0.19 0.19 0.2 0.13
Spain 0.9 0.2 0.18 0.2 0.17 0.15
Malaysia 0.89 0.18 0.2 0.2 0.2 0.12
Norway 0.89 0.19 0.2 0.18 0.19 0.14
Canada 0.89 0.2 0.19 0.2 0.17 0.14
Australia 0.89 0.2 0.17 0.2 0.18 0.14
Something like:
awk -F '</*td>|</*tr>' '{ for (i=5;i<=NF-1;i+=2) print $i }' file
should get you the values, but they will be output in a single column so you will need to format the column further with e.g.
awk -F '</*td>|</*tr>' '{ for (i=5;i<=NF-1;i+=2) print $i }' test | awk -v RS= '{gsub(/\n/, "\t")}1'
United Kingdom 0.93 0.2 0.19 0.2 0.19 0.15
United States 0.93 0.2 0.18 0.2 0.19 0.15
France 0.92 0.2 0.19 0.2 0.19 0.14
Lithuania 0.91 0.2 0.17 0.2 0.19 0.16
Estonia 0.91 0.2 0.2 0.19 0.17 0.15
Singapore 0.9 0.2 0.19 0.19 0.2 0.13
Spain 0.9 0.2 0.18 0.2 0.17 0.15
Malaysia 0.89 0.18 0.2 0.2 0.2 0.12
Norway 0.89 0.19 0.2 0.18 0.19 0.14
Canada 0.89 0.2 0.19 0.2 0.17 0.14
Australia 0.89 0.2 0.17 0.2 0.18 0.14
Check how your regex is matching each field. Each line of the output starts with the number of the field you came up with. Empty lines mean <tr> and <td> were side by side.
You could try this, instead:
BEGIN{RS="<\/?t[dr]><\/?t[dr]>";ORS=" "}
$0 && !/^</
END{printf "\n"}
Try it online!
It removes all trs and tds, regarding them as record separators. The output record separator becomes a space. Then, only prints non-blank records that do not start with <, i.e., that do not start with a html tag. Also prints a trailing newline, for the sake of POSIX definition of a line.
Based on your attempt, seems like number of columns per row is known to be 7. So, you can use tools like xpath or xmllint and then use pr to format the output.
$ # same as: xmllint --xpath '//tr/td/text()'
$ xpath -q -e '//tr/td/text()' ip.html | pr -7ats' '
United Kingdom 0.93 0.2 0.19 0.2 0.19 0.15
United States 0.93 0.2 0.18 0.2 0.19 0.15
France 0.92 0.2 0.19 0.2 0.19 0.14
Lithuania 0.91 0.2 0.17 0.2 0.19 0.16
Estonia 0.91 0.2 0.2 0.19 0.17 0.15
Singapore 0.9 0.2 0.19 0.19 0.2 0.13
Spain 0.9 0.2 0.18 0.2 0.17 0.15
Malaysia 0.89 0.18 0.2 0.2 0.2 0.12
Norway 0.89 0.19 0.2 0.18 0.19 0.14
Canada 0.89 0.2 0.19 0.2 0.17 0.14
Australia 0.89 0.2 0.17 0.2 0.18 0.14
I have 8 RTX GPUs. When run p2pBandwidthLatencyTest, The latencies between GPU0 and GPU1, GPU2 and GPU3, GPU4 and GPU5, GPU6 and GPU7 is 40,000 times slower than other pairs:
P2P=Enabled Latency (P2P Writes) Matrix (us)
GPU 0 1 2 3 4 5 6 7
0 1.80 49354.72 1.70 1.70 1.74 1.74 1.74 1.72
1 49354.84 1.37 1.70 1.69 1.74 1.76 1.73 1.72
2 1.88 1.81 1.73 49355.00 1.79 1.76 1.76 1.75
3 1.88 1.79 49354.85 1.33 3.79 3.84 3.88 3.91
4 1.89 1.88 1.90 1.87 1.72 49354.96 3.49 3.56
5 2.30 1.93 1.88 1.89 49354.89 1.32 3.63 3.60
6 2.55 2.53 2.37 2.29 2.24 2.26 3.50 49354.77
7 2.30 2.27 2.29 1.87 1.82 1.83 49354.85 1.36
Compare it with when peer-to-peer is disabled:
P2P=Disabled Latency Matrix (us)
GPU 0 1 2 3 4 5 6 7
0 1.80 14.31 13.86 13.49 14.52 13.89 13.58 13.58
1 13.71 1.82 14.44 13.95 14.65 13.62 15.05 15.20
2 13.38 14.23 1.73 16.59 13.77 15.44 14.10 13.64
3 12.68 15.62 12.50 1.77 14.92 15.01 15.17 14.87
4 13.51 13.60 15.09 13.40 1.27 12.48 12.68 19.47
5 14.92 13.84 13.42 13.42 16.53 1.30 16.37 16.60
6 14.29 13.62 14.66 13.62 14.90 13.70 1.32 14.33
7 14.26 13.42 14.35 13.53 16.89 14.26 17.03 1.36
Is this normal?
It turns out the super slow peer-to-peer is abnormal.
After I disable IOMMU (Intel VT-d) in the BIOS, the problem is gone:
P2P=Enabled Latency (P2P Writes) Matrix (us)
GPU 0 1 2 3 4 5 6 7
0 1.34 1.22 1.68 1.69 1.71 1.70 1.75 1.73
1 1.20 1.38 1.70 1.67 1.71 1.75 1.75 1.72
2 1.69 1.67 1.29 1.20 1.73 1.75 1.75 1.75
3 1.69 1.66 1.17 1.29 1.74 1.75 1.72 1.73
4 1.72 1.76 1.74 1.70 1.32 1.13 1.66 1.70
5 1.74 1.73 1.75 1.74 1.18 1.28 1.67 1.69
6 1.75 1.74 1.74 1.72 1.67 1.68 1.31 1.19
7 1.76 1.75 1.73 1.73 1.67 1.69 1.18 1.32
It seems the problem is the same as or is very similar to discussions in:
https://github.com/pytorch/pytorch/issues/1637
https://github.com/pytorch/pytorch/issues/24081
A few possible solutions are mentioned in the discussions:
Disable IOMMU:
https://github.com/pytorch/pytorch/issues/1637#issuecomment-338268158
https://github.com/pytorch/pytorch/issues/1637#issuecomment-401422046
Disable ACS:
https://github.com/pytorch/pytorch/issues/24081#issuecomment-557074611
https://github.com/pytorch/pytorch/issues/24081#issuecomment-547976127
My system having the problem only had IOMMU enabled in the BIOS. ACS was not turned on as lspci -vvv | grep ACS got back nothing.
==============================
Background on I/O MMU:
https://en.wikipedia.org/wiki/X86_virtualization#I/O_MMU_virtualization_(AMD-Vi_and_Intel_VT-d)
It's part of the x86 virtualization. It's the virtualization done by the chipset. Besides the name IOMMU, it's also called AMD-Vi or Intel VT-d. Not to be confused with AMD-V and Intel VT-x which are virtualization via the CPU.
I have growth data of trees for the month of June across multiple years. Around the beginning of June in 2012, 2013 and 2014, I planted seeds and went back to those seeds near the end of the month to see if the seeds germinated and the tree was alive, or didn't germinate and the tree was dead. For each sample (each seed), the number of growing days were calculated.
Sample_ID Tree_Type Check_Date Growing_Days Status Max_Temp Min_Temp Mean_Temp Total_mm_Rain
1 Spruce 25-06-2012 16 Alive
2 Spruce 28-06-2012 25 Alive
3 Fir 23-06-2012 19 Dead
4 Spruce 29-06-2012 23 Alive
5 Fir 28-06-2012 16 Alive
6 Fir 25-06-2013 18 Alive
7 Fir 26-06-2013 15 Dead
8 Spruce 28-06-2013 17 Alive
9 Fir 30-06-2013 24 Dead
10 Fir 27-06-2013 19 Alive
11 Spruce 21-06-2014 16 Alive
12 Fir 24-06-2014 18 Alive
13 Fir 28-06-2014 14 Dead
14 Spruce 29-06-2014 18 Alive
15 Spruce 30-06-2014 15 Dead
What I would like to is see how weather affected my trees. I have pulled historical weather data as a separate dataframe and would like to add to each sample row the Total_mm_Rain that fell during the growing days, along with Max, Min and Mean Temperatures of that growing period.
Date Max_Temp Min_Temp Mean_Temp Total_mm_Rain
01-05-2012 9 3 6 0
02-05-2012 9 2.5 5.8 0
03-05-2012 9.5 -2.5 3.5 4.6
04-05-2012 11 2.5 6.8 0.6
05-05-2012 10 2 6 1.8
06-05-2012 14 -2 6 0
07-05-2012 18 -2 8 0
08-05-2012 21.5 1 11.3 0
09-05-2012 17.5 4.5 11 2.8
10-05-2012 8 0.5 4.3 0
11-05-2012 14.5 -6 4.3 0
12-05-2012 19.5 -3 8.3 0
13-05-2012 23.5 -1 11.3 0
14-05-2012 25 0.5 12.8 0
15-05-2012 27.5 1.5 14.5 0
16-05-2012 24 2.5 13.3 0
17-05-2012 15.5 4.5 10 10
18-05-2012 12.5 2 7.3 0.4
19-05-2012 15 -2 6.5 0
20-05-2012 17.5 -2 7.8 0.4
21-05-2012 15.5 6.5 11 2.2
22-05-2012 12.5 8 10.3 0.4
23-05-2012 14 5 9.5 9.6
24-05-2012 10 1 5.5 1
25-05-2012 11 3 7 3
26-05-2012 13 2 7.5 0
27-05-2012 11.5 3 7.3 0
28-05-2012 17.5 3 10.3 1.2
29-05-2012 15.5 4 9.8 0.2
30-05-2012 17.6 4 10.8 0
31-05-2012 16 6.5 11.3 0.2
01-05-2013 11.5 -4.9 3.3 0
02-05-2013 17.1 -4.5 6.3 2
03-05-2013 15 5.1 10.1 0
04-05-2013 18.9 -0.2 9.4 0
05-05-2013 24.2 -1.8 11.2 0
06-05-2013 26.6 -0.1 13.3 0
07-05-2013 21.9 1.5 11.7 0
08-05-2013 24.6 4.9 14.8 0
09-05-2013 25.5 0.9 13.2 0
10-05-2013 21.4 2 11.7 0
11-05-2013 26.2 3.9 15.1 0
12-05-2013 25 4.5 14.8 0.2
13-05-2013 19.9 10.2 15.1 11
14-05-2013 13.1 5 9.1 0.2
15-05-2013 17.2 -1.7 7.8 0
16-05-2013 15.3 4.1 9.7 0
17-05-2013 18.6 2.4 10.5 1.6
18-05-2013 15.5 3 9.3 5.6
19-05-2013 12.7 5.6 9.2 1
20-05-2013 22 5 13.5 0
21-05-2013 21.9 1.9 11.9 0
22-05-2013 12 7 9.5 24.8
23-05-2013 7.3 0.1 3.7 4.6
24-05-2013 12.3 1.5 6.9 0.2
25-05-2013 13.7 3.7 8.7 0
26-05-2013 19 -1.5 8.8 0
27-05-2013 20 3.5 11.8 0
28-05-2013 17 5.5 11.3 0
29-05-2013 20.1 7 13.6 0.8
30-05-2013 13.5 7.5 10.5 2.4
31-05-2013 9.9 7 8.5 7.8
01-06-2014 8.8 -1 3.9 3.6
02-06-2014 11.4 0.5 6 0
03-06-2014 11.6 -0.7 5.5 0
04-06-2014 16.9 -3.6 6.7 0
05-06-2014 19.6 -2.3 8.7 0
06-06-2014 16.7 0.9 8.8 0
07-06-2014 9.3 5 7.2 1
08-06-2014 10.1 2.8 6.5 0.4
09-06-2014 13.3 -5.2 4.1 0
10-06-2014 16 -4.3 5.9 0
11-06-2014 17 -1.5 7.8 1.6
12-06-2014 13.9 4.7 9.3 0.3
13-06-2014 16.5 -3.4 6.6 0
14-06-2014 22.9 -2.3 10.3 0
15-06-2014 27 0.6 13.8 0
16-06-2014 29.6 4.1 16.9 0
17-06-2014 29.1 3.3 16.2 0
18-06-2014 28.1 5.6 16.9 0
19-06-2014 25.9 8.1 17 0.2
20-06-2014 15.9 8.7 12.3 3.1
21-06-2014 21.3 8.8 15.1 0.4
22-06-2014 23.7 6.7 15.2 6.9
23-06-2014 18.4 9.3 13.9 0
24-06-2014 18.2 4 11.1 6.4
25-06-2014 16 6.5 11.3 10
26-06-2014 12.2 3.6 7.9 1.9
27-06-2014 11.6 3.5 7.6 2.6
28-06-2014 13.7 4.4 9.1 5.6
29-06-2014 11.7 5.5 8.6 3.4
30-06-2014 17.4 7 12.2 0
I have tried using table functions as well as diving into the idea of converting dates to numbers (as in excel) and summing based on dates as numbers instead of dates, but this is above my knowledge of R.
I have multiple number of rows. I want to change into column wise.
My data
PondCrop DOC ABW TargetABW
01PA01-18 7 0 0.21
01PA01-18 15 0.59 0.77
01PA01-18 22 1.24 1.5
01PA01-18 28 0.92 2.6
01PA01-18 35 1.82 3.7
01PA01-18 42 2.6 4.8
01PA01-18 49 3.62 5.9
01PA01-18 56 4.64 7
01PA01-18 63 5.54 8.1
01PA01-18 66 6.24 8.1
01PA01-18 73 7.25 9.2
01PA02-18 7 0 0.21
01PA02-18 15 0.59 0.77
01PA02-18 22 1.24 1.5
01PA02-18 28 0.87 2.6
01PA02-18 35 1.8 3.7
01PA02-18 42 2.4 4.8
01PA02-18 49 3.51 5.9
01PA02-18 56 4.6 7
01PA02-18 63 5.51 8.1
01PA02-18 66 6.53 8.1
01PA02-18 73 7.42 9.2
01PA03-18 14 0.53 0.77
01PA03-18 21 1.14 1.5
01PA03-18 27 0.91 1.5
01PA03-18 34 1.67 2.6
01PA03-18 41 2.2 3.7
01PA03-18 48 3.24 4.8
01PA03-18 55 4.31 5.9
01PA03-18 62 4.94 7
01PA03-18 65 5.44 8.1
01PA03-18 72 6.41 9.2
01PA04-18 14 0.53 0.77
01PA04-18 21 1.14 1.5
01PA04-18 27 0.9 1.5
01PA04-18 34 1.52 2.6
01PA04-18 41 1.9 3.7
01PA04-18 48 2.6 4.8
01PA04-18 55 3.52 5.9
01PA04-18 62 4.21 7
01PA04-18 65 4.82 8.1
01PA04-18 72 5.87 9.2
01PA05-18 14 0.53 0.77
01PA05-18 21 1.14 1.5
01PA05-18 27 0.92 1.5
01PA05-18 34 1.49 2.6
01PA05-18 41 1.91 3.7
01PA05-18 48 2.64 4.8
01PA05-18 55 3.69 5.9
01PA05-18 62 4.19 7
01PA05-18 65 4.72 8.1
01PA05-18 72 5.74 9.2
01PA06-18 13 0.48 0.21
01PA06-18 20 1.04 0.77
01PA06-18 26 0.74 1.5
01PA06-18 33 1.25 2.6
01PA06-18 40 1.82 3.7
01PA06-18 47 3.12 4.8
01PA06-18 54 4.4 5.9
01PA06-18 61 5.44 7
01PA06-18 64 6.46 8.1
01PA06-18 71 7.3 9.2
01PA07-18 13 0.48 0.21
01PA07-18 20 1.04 0.77
01PA07-18 26 0.72 1.5
01PA07-18 33 1.32 2.6
01PA07-18 40 1.84 3.7
01PA07-18 47 3.05 4.8
01PA07-18 54 4.12 5.9
01PA07-18 61 5.21 7
01PA07-18 64 6 8.1
01PA07-18 71 6.9 9.2
01PA08-18 13 0.48 0.21
01PA08-18 20 1.04 0.77
01PA08-18 26 0.7 1.5
01PA08-18 33 1.3 2.6
01PA08-18 40 1.8 3.7
01PA08-18 47 3.07 4.8
01PA08-18 54 3.72 5.9
01PA08-18 61 4.52 7
01PA08-18 64 5.11 8.1
01PA08-18 71 5.87 9.2
01PA09-18 13 0.48 0.21
01PA09-18 20 1.04 0.77
01PA09-18 26 0.71 1.5
01PA09-18 33 1.22 2.6
01PA09-18 40 1.85 3.7
01PA09-18 47 2.9 4.8
01PA09-18 54 3.74 5.9
01PA09-18 61 4.4 7
01PA09-18 64 4.92 8.1
01PA09-18 71 5.78 9.2
01PB01-19 8 0 0.21
01PB01-19 15 0 0.77
01PB01-19 23 0.94 1.5
01PB01-19 30 1.85 2.6
01PB01-19 36 2.5 3.7
01PB01-19 43 3.1 4.8
01PB01-19 50 3.74 5.9
01PB01-19 57 5.05 7
01PB01-19 64 6.18 8.1
01PB01-19 71 7.03 9.2
01PB01-19 74 7.87 9.2
01PB01-19 81 8.41 10.3
01PB02-19 8 0 0.21
01PB02-19 15 0 0.77
01PB02-19 23 0.98 1.5
01PB02-19 30 1.82 2.6
01PB02-19 36 2.6 3.7
01PB02-19 43 3.4 4.8
01PB02-19 50 4 5.9
01PB02-19 57 5.5 7
01PB02-19 64 6.72 8.1
01PB02-19 71 7.5 9.2
01PB02-19 74 8.43 9.2
01PB02-19 81 9.6 10.3
01PB03-19 8 0 0.21
01PB03-19 15 0 0.77
01PB03-19 23 0.92 1.5
01PB03-19 30 1.88 2.6
01PB03-19 36 2.51 3.7
01PB03-19 43 3 4.8
01PB03-19 50 3.4 5.9
01PB03-19 57 5.03 7
01PB03-19 64 6.27 8.1
01PB03-19 71 7.32 9.2
01PB03-19 74 8.2 9.2
01PB03-19 81 9.6 10.3
01PB04-19 13 0 0.21
01PB04-19 21 1.14 1.5
01PB04-19 28 0.93 2.6
01PB04-19 34 1.3 2.6
01PB04-19 41 2.1 3.7
01PB04-19 48 2.9 4.8
01PB04-19 55 3.7 5.9
01PB04-19 62 4.49 7
01PB04-19 69 5.3 8.1
01PB04-19 72 6.08 9.2
01PB04-19 79 7.55 10.3
01PB05-19 13 0 0.21
01PB05-19 21 1.14 1.5
01PB05-19 28 0.83 2.6
01PB05-19 34 1.41 2.6
01PB05-19 41 1.9 3.7
01PB05-19 48 2.6 4.8
01PB05-19 55 3.37 5.9
01PB05-19 62 4.32 7
01PB05-19 69 5.03 8.1
01PB05-19 72 5.84 9.2
01PB05-19 79 6.9 10.3
01PB06-19 13 0 0.21
01PB06-19 21 1.14 1.5
01PB06-19 28 0.86 2.6
01PB06-19 34 1.4 2.6
01PB06-19 41 2.2 3.7
01PB06-19 48 2.9 4.8
01PB06-19 55 3.5 5.9
01PB06-19 62 4.61 7
01PB06-19 69 5.3 8.1
01PB06-19 72 6.18 9.2
01PB06-19 79 7.06 10.3
01PB07-19 12 0 0.21
01PB07-19 20 1.04 0.77
01PB07-19 27 0.85 1.5
01PB07-19 33 1.06 2.6
01PB07-19 40 1.96 3.7
01PB07-19 47 2.6 4.8
01PB07-19 54 3.45 5.9
01PB07-19 61 4.23 7
01PB07-19 68 5.04 8.1
01PB07-19 71 5.85 9.2
01PB07-19 78 6.7 10.3
01PB08-19 12 0 0.21
01PB08-19 20 1.04 0.77
01PB08-19 27 0.85 1.5
01PB08-19 33 1.2 2.6
01PB08-19 40 1.9 3.7
01PB08-19 47 2.7 4.8
01PB08-19 54 3.62 5.9
01PB08-19 61 4.49 7
01PB08-19 68 5.13 8.1
01PB08-19 71 6 9.2
01PB08-19 78 6.9 10.3
01PB09-19 12 0 0.21
01PB09-19 20 1.04 0.77
01PB09-19 27 0.78 1.5
01PB09-19 33 1.4 2.6
01PB09-19 40 2 3.7
01PB09-19 47 2.7 4.8
01PB09-19 54 3.86 5.9
01PB09-19 61 5.47 7
01PB09-19 68 6.03 8.1
01PB09-19 71 6.9 9.2
01PB09-19 78 7.5 10.3
01PC01-19 8 0 0.21
01PC01-19 15 0 0.77
01PC01-19 23 1.34 1.5
01PC01-19 30 1.77 2.6
01PC01-19 36 2.1 3.7
01PC01-19 43 3.2 4.8
01PC01-19 50 3.7 5.9
01PC01-19 57 4.6 7
01PC01-19 64 5.5 8.1
01PC01-19 71 6 9.2
01PC01-19 74 7 9.2
01PC01-19 81 7.4 10.3
01PC02-19 7 0 0.21
01PC02-19 14 0 0.77
01PC02-19 22 1.24 1.5
01PC02-19 29 1.56 2.6
01PC02-19 35 2.4 3.7
01PC02-19 42 3.1 4.8
01PC02-19 49 3.5 5.9
01PC02-19 56 4.34 7
01PC02-19 63 5.3 8.1
01PC02-19 70 6.2 9.2
01PC02-19 73 7 9.2
01PC02-19 80 7.85 10.3
01PC03-19 7 0 0.21
01PC03-19 14 0 0.77
01PC03-19 22 1.24 1.5
01PC03-19 29 1.62 2.6
01PC03-19 35 2.2 3.7
01PC03-19 42 2.6 4.8
01PC03-19 49 3.1 5.9
01PC03-19 56 4.1 7
01PC03-19 63 5 8.1
01PC03-19 70 5.9 9.2
01PC03-19 73 6.5 9.2
01PC03-19 80 7.6 10.3
01PC04-20 13 0 0.21
01PC04-20 21 1.14 1.5
01PC04-20 28 0.81 2.6
01PC04-20 34 1.5 2.6
01PC04-20 41 2.2 3.7
01PC04-20 48 2.9 4.8
01PC04-20 55 3.4 5.9
01PC04-20 62 4.5 7
01PC04-20 69 5 8.1
01PC04-20 72 6 9.2
01PC04-20 79 6.9 10.3
01PC05-19 13 0 0.21
01PC05-19 21 1.14 1.5
01PC05-19 28 0.88 2.6
01PC05-19 34 1.22 2.6
01PC05-19 41 2 3.7
01PC05-19 48 2.54 4.8
01PC05-19 55 3.1 5.9
01PC05-19 62 4.2 7
01PC05-19 69 4.6 8.1
01PC05-19 72 5.5 9.2
01PC05-19 79 6.2 10.3
01PC06-19 11 0 0.21
01PC06-19 19 0.94 0.77
01PC06-19 26 0.85 1.5
01PC06-19 32 1.05 2.6
01PC06-19 39 2.3 3.7
01PC06-19 46 2.9 4.8
01PC06-19 53 3.8 5.9
01PC06-19 60 4.3 7
01PC06-19 67 5 8.1
01PC06-19 70 5.8 9.2
01PC06-19 77 6.8 10.3
01PC07-19 11 0 0.21
01PC07-19 19 0.94 0.77
01PC07-19 26 0.79 1.5
01PC07-19 32 1.4 2.6
01PC07-19 39 1.98 3.7
01PC07-19 46 2.7 4.8
01PC07-19 53 3 5.9
01PC07-19 60 3.9 7
01PC07-19 67 5 8.1
01PC07-19 70 5.6 9.2
01PC07-19 77 6.14 10.3
01PC08-19 11 0 0.21
01PC08-19 19 0.94 0.77
01PC08-19 26 0.9 1.5
01PC08-19 32 1.2 2.6
01PC08-19 39 2 3.7
01PC08-19 46 2.5 4.8
01PC08-19 53 3 5.9
01PC08-19 60 4.1 7
01PC08-19 67 4.91 8.1
01PC08-19 70 5.5 9.2
01PC08-19 77 6 10.3
01PC09-20 11 0 0.21
01PC09-20 19 0.94 0.77
01PC09-20 26 0.8 1.5
01PC09-20 32 1.2 2.6
01PC09-20 39 1.95 3.7
01PC09-20 46 2.65 4.8
01PC09-20 53 3 5.9
01PC09-20 60 4.18 7
01PC09-20 67 5 8.1
01PC09-20 70 5.8 9.2
01PC09-20 77 6.4 10.3
01PD01-09 10 0 0.21
01PD01-09 18 0.84 0.77
01PD01-09 25 0.78 1.5
01PD01-09 31 1.02 2.6
01PD01-09 38 1.92 3.7
01PD01-09 45 2.52 4.8
01PD01-09 52 3.4 5.9
01PD01-09 59 4.11 7
01PD01-09 66 5.03 8.1
01PD01-09 69 5.7 8.1
01PD01-09 76 6.7 9.2
01PD02-09 10 0 0.21
01PD02-09 18 0.84 0.77
01PD02-09 25 0.8 1.5
01PD02-09 31 1.03 2.6
01PD02-09 38 1.88 3.7
01PD02-09 45 2.47 4.8
01PD02-09 52 3.33 5.9
01PD02-09 59 4.04 7
01PD02-09 66 4.85 8.1
01PD02-09 69 5.6 8.1
01PD02-09 76 6.45 9.2
01PD03-09 10 0 0.21
01PD03-09 18 0.84 0.77
01PD03-09 25 0.81 1.5
01PD03-09 31 0.99 2.6
01PD03-09 38 1.8 3.7
01PD03-09 45 2.45 4.8
01PD03-09 52 3.14 5.9
01PD03-09 59 4.01 7
01PD03-09 66 4.91 8.1
01PD03-09 69 5.5 8.1
01PD03-09 76 6.5 9.2
01PD04-09 8 0 0.21
01PD04-09 16 0.64 0.77
01PD04-09 23 0.67 1.5
01PD04-09 29 0.96 2.6
01PD04-09 36 1.9 3.7
01PD04-09 43 2.53 4.8
01PD04-09 50 3.26 5.9
01PD04-09 57 4.38 7
01PD04-09 64 5.42 8.1
01PD04-09 67 6.03 8.1
01PD04-09 74 6.6 9.2
01PD05-09 8 0 0.21
01PD05-09 16 0.64 0.77
01PD05-09 23 0.7 1.5
01PD05-09 29 1.02 2.6
01PD05-09 36 2.07 3.7
01PD05-09 43 2.72 4.8
01PD05-09 50 3.6 5.9
01PD05-09 57 4.56 7
01PD05-09 64 5.52 8.1
01PD05-09 67 6.2 8.1
01PD05-09 74 6.9 9.2
01PD08-09 8 0 0.21
01PD08-09 16 0.64 0.77
01PD08-09 23 0.86 1.5
01PD08-09 29 1.34 2.6
01PD08-09 36 2.23 3.7
01PD08-09 43 2.77 4.8
01PD08-09 50 3.79 5.9
01PD08-09 57 4.59 7
01PD08-09 64 5.62 8.1
01PD08-09 67 5.97 8.1
01PD08-09 74 7 9.2
01PD09-09 8 0 0.21
01PD09-09 16 0.64 0.77
01PD09-09 23 0.82 1.5
01PD09-09 29 1.34 2.6
01PD09-09 36 2.35 3.7
01PD09-09 43 2.79 4.8
01PD09-09 50 3.82 5.9
01PD09-09 57 4.64 7
01PD09-09 64 5.65 8.1
01PD09-09 67 6.04 8.1
01PD09-09 74 7.04 9.2
01PD10-10 14 0.53 0.77
01PD10-10 21 1.14 1.5
01PD10-10 27 0.89 1.5
01PD10-10 34 1.69 2.6
01PD10-10 41 2.31 3.7
01PD10-10 48 3.14 4.8
01PD10-10 55 4.2 5.9
01PD10-10 62 5.22 7
01PD10-10 65 5.82 8.1
01PD10-10 72 6.84 9.2
03PA01-17 11 0.37 0.21
03PA01-17 18 0.84 0.77
03PA01-17 24 0.75 1.5
03PA01-17 31 1.65 2.6
03PA01-17 38 2.5 3.7
03PA01-17 45 3.45 4.8
03PA01-17 52 4.1 5.9
03PA01-17 59 4.56 7
03PA01-17 62 4.8 7
03PA01-17 69 5.6 8.1
03PA02-17 11 0.37 0.21
03PA02-17 18 0.84 0.77
03PA02-17 24 0.55 1.5
03PA02-17 31 1.5 2.6
03PA02-17 38 2.3 3.7
03PA02-17 45 3.3 4.8
03PA02-17 52 4.4 5.9
03PA02-17 59 5.06 7
03PA02-17 62 5.5 7
03PA02-17 69 6.4 8.1
03PA03-17 11 0.37 0.21
03PA03-17 18 0.84 0.77
03PA03-17 24 0.65 1.5
03PA03-17 31 1.7 2.6
03PA03-17 38 2.16 3.7
03PA03-17 45 3.1 4.8
03PA03-17 52 4.3 5.9
03PA03-17 59 6.14 7
03PA03-17 62 6.5 7
03PA03-17 69 7.3 8.1
03PA04-16 11 0.37 0.21
03PA04-16 18 0.84 0.77
03PA04-16 24 0.45 1.5
03PA04-16 31 1.4 2.6
03PA04-16 38 2.1 3.7
03PA04-16 45 2.95 4.8
03PA04-16 52 4 5.9
03PA04-16 59 4.23 7
03PA04-16 62 4.7 7
03PA04-16 69 5.6 8.1
03PA05-16 9 0.26 0.21
03PA05-16 16 0.64 0.77
03PA05-16 22 1.34 1.5
03PA05-16 29 1.35 2.6
03PA05-16 36 2.2 3.7
03PA05-16 43 3.15 4.8
03PA05-16 50 3.9 5.9
03PA05-16 57 4.46 7
03PA05-16 60 4.8 7
03PA05-16 67 5.8 8.1
03PA06-16 7 0.19 0.21
03PA06-16 14 0.53 0.77
03PA06-16 20 1.14 0.77
03PA06-16 27 0.65 1.5
03PA06-16 34 1.4 2.6
03PA06-16 41 2.6 3.7
03PA06-16 48 3.7 4.8
03PA06-16 55 4.44 5.9
03PA06-16 58 4.85 7
03PA06-16 65 6 8.1
03PA07-16 8 0.22 0.21
03PA07-16 14 0.59 0.77
03PA07-16 21 0.55 1.5
03PA07-16 28 1.25 2.6
03PA07-16 35 2.4 3.7
03PA07-16 42 3.5 4.8
03PA07-16 49 4.18 5.9
03PA07-16 52 4.55 5.9
03PA07-16 59 5.7 7
03PA08-17 8 0.22 0.21
03PA08-17 14 0.59 0.77
03PA08-17 21 0.68 1.5
03PA08-17 28 1.5 2.6
03PA08-17 35 2.65 3.7
03PA08-17 42 3.9 4.8
03PA08-17 49 5.3 5.9
03PA08-17 52 5.8 5.9
03PA08-17 59 7.6 7
03PB02-16 7 0.19 0.21
03PB02-16 14 0.53 0.77
03PB02-16 20 1.14 0.77
03PB02-16 27 0.7 1.5
03PB02-16 34 1.6 2.6
03PB02-16 41 2.6 3.7
03PB02-16 48 3 4.8
03PB02-16 55 4.22 5.9
03PB02-16 58 4.65 7
03PB02-16 65 5.8 8.1
03PB05-16 13 0.48 0.21
03PB05-16 19 1.04 0.77
03PB05-16 26 0.9 1.5
03PB05-16 33 1.5 2.6
03PB05-16 40 2.5 3.7
03PB05-16 47 3.1 4.8
03PB05-16 54 3.78 5.9
03PB05-16 57 4.45 7
03PB05-16 64 5.6 8.1
03PB06-16 13 0.48 0.21
03PB06-16 19 1.04 0.77
03PB06-16 26 0.9 1.5
03PB06-16 33 1.7 2.6
03PB06-16 40 2.5 3.7
03PB06-16 47 3 4.8
03PB06-16 54 3.47 5.9
03PB06-16 57 4.1 7
03PB06-16 64 5 8.1
03PB07-16 13 0.48 0.21
03PB07-16 19 1.04 0.77
03PB07-16 26 0.7 1.5
03PB07-16 33 1.6 2.6
03PB07-16 40 2.4 3.7
03PB07-16 47 3 4.8
03PB07-16 54 3.5 5.9
03PB07-16 57 4 7
03PB07-16 64 4.8 8.1
03PB08-15 12 0.42 0.21
03PB08-15 18 0.94 0.77
03PB08-15 25 0.9 1.5
03PB08-15 32 1.5 2.6
03PB08-15 39 2.6 3.7
03PB08-15 46 3.1 4.8
03PB08-15 53 5.66 5.9
03PB08-15 56 6.1 7
03PB08-15 63 7 8.1
03PC01-16 7 0.22 0.21
03PC01-16 10 0.37 0.21
03PC01-16 17 0.84 0.77
03PC02-16 12 0.42 0.21
03PC02-16 18 0.94 0.77
03PC02-16 25 1.01 1.5
03PC02-16 32 1.73 2.6
03PC02-16 39 2.59 3.7
03PC02-16 46 3.25 4.8
03PC02-16 53 3.82 5.9
03PC02-16 56 4.15 7
03PC02-16 63 5.33 8.1
03PC03-16 9 0.26 0.21
03PC03-16 15 0.64 0.77
03PC03-16 22 1.01 1.5
03PC03-16 29 1.84 2.6
03PC03-16 36 2.31 3.7
03PC03-16 43 3.32 4.8
03PC03-16 50 4.77 5.9
03PC03-16 53 5.1 5.9
03PC03-16 60 5.57 7
03PC04-15 9 0.26 0.21
03PC04-15 15 0.64 0.77
03PC04-15 22 0.99 1.5
03PC04-15 29 1.83 2.6
03PC04-15 36 2.25 3.7
03PC04-15 43 3.23 4.8
03PC04-15 50 4.82 5.9
03PC04-15 53 5.2 5.9
03PC04-15 60 5.64 7
03PC05-15 11 0.42 0.21
03PC05-15 18 0.94 0.77
03PC05-15 25 0.83 1.5
03PC05-15 32 1.5 2.6
03PC05-15 39 2.28 3.7
03PC05-15 46 2.92 4.8
03PC05-15 49 3.3 5.9
03PC05-15 56 3.55 7
03PC06-16 11 0.42 0.21
03PC06-16 18 0.94 0.77
03PC06-16 25 0.84 1.5
03PC06-16 32 1.53 2.6
03PC06-16 39 2.69 3.7
03PC06-16 46 3.82 4.8
03PC06-16 49 4.3 5.9
03PC06-16 56 5.37 7
03PC07-15 12 0.42 0.21
03PC07-15 18 0.94 0.77
03PC07-15 25 0.99 1.5
03PC07-15 32 1.82 2.6
03PC07-15 39 2.65 3.7
03PC07-15 46 3.04 4.8
03PC07-15 53 3.45 5.9
03PC07-15 56 3.9 7
03PC07-15 63 4.77 8.1
03PC08-14 11 0.37 0.21
03PC08-14 17 0.84 0.77
03PC08-14 24 0.99 1.5
03PC08-14 31 1.75 2.6
03PC08-14 38 2.45 3.7
03PC08-14 45 3.07 4.8
03PC08-14 52 3.45 5.9
03PC08-14 55 3.95 5.9
03PC08-14 62 4.72 7
03PD01-14 7 0.19 0.21
03PD01-14 13 0.53 0.21
03PD01-14 20 1.14 0.77
03PD01-14 27 0.7 1.5
03PD01-14 34 1.75 2.6
03PD01-14 41 2.64 3.7
03PD01-14 48 3.49 4.8
03PD01-14 51 4.2 5.9
03PD01-14 58 5.2 7
03PD02-14 7 0.19 0.21
03PD02-14 13 0.53 0.21
03PD02-14 20 1.14 0.77
03PD02-14 27 0.85 1.5
03PD02-14 34 1.85 2.6
03PD02-14 41 2.85 3.7
03PD02-14 48 5.35 4.8
03PD02-14 51 5.5 5.9
03PD02-14 58 6.5 7
03PD03-14 11 0.37 0.21
03PD03-14 17 0.84 0.77
03PD03-14 24 0.78 1.5
03PD03-14 31 1.78 2.6
03PD03-14 38 2.55 3.7
03PD03-14 45 3.43 4.8
03PD03-14 52 5.2 5.9
03PD03-14 55 5.4 5.9
03PD03-14 62 6.2 7
03PD04-14 9 0.26 0.21
03PD04-14 15 0.64 0.77
03PD04-14 22 0.65 1.5
03PD04-14 29 1.84 2.6
03PD04-14 36 2.62 3.7
03PD04-14 43 3.38 4.8
03PD04-14 50 5.51 5.9
03PD04-14 53 5.85 5.9
03PD04-14 60 6.95 7
03PD05-15 7 0.19 0.21
03PD05-15 13 0.53 0.21
03PD05-15 20 1.14 0.77
03PD05-15 27 0.55 1.5
03PD05-15 34 1.53 2.6
03PD05-15 41 2.7 3.7
03PD05-15 48 3.57 4.8
03PD05-15 51 4.1 5.9
03PD05-15 58 5.1 7
03PD06-14 9 0.26 0.21
03PD06-14 15 0.64 0.77
03PD06-14 22 0.6 1.5
03PD06-14 29 1.7 2.6
03PD06-14 36 2.76 3.7
03PD06-14 43 3.37 4.8
03PD06-14 50 4.36 5.9
03PD06-14 53 4.7 5.9
03PD06-14 60 5.6 7
03PD07-15 7 0.22 0.21
03PD07-15 10 0.37 0.21
03PD07-15 17 0.84 0.77
03PD08-15 9 0.26 0.21
03PD08-15 15 0.64 0.77
03PD08-15 22 0.7 1.5
03PD08-15 29 1.85 2.6
03PD08-15 36 2.65 3.7
03PD08-15 43 3.4 4.8
03PD08-15 50 5.15 5.9
03PD08-15 53 5.6 5.9
03PD08-15 60 6.6 7
05PA05-13 11 0 0.21
05PA05-13 17 0 0.77
05PA05-13 24 0 1.5
05PA05-13 25 0 1.5
05PB01-14 9 0 0.21
05PB01-14 9 0 0.21
05PB01-14 22 1.4 1.5
05PB01-14 30 2.4 2.6
06PA01-13 10 0.37 0.21
06PA01-13 17 0.84 0.77
06PA01-13 24 1.1 1.5
06PA01-13 31 2.3 2.6
06PA01-13 34 3.23 2.6
06PA01-13 41 4.61 3.7
06PA02-14 10 0.37 0.21
06PA02-14 17 0.84 0.77
06PA02-14 24 1 1.5
06PA02-14 31 2.1 2.6
06PA02-14 34 3.23 2.6
06PA02-14 41 4.1 3.7
06PA03-14 12 0.48 0.21
06PA03-14 19 1.04 0.77
06PA03-14 26 0.75 1.5
06PA03-14 29 2 2.6
06PA03-14 36 2.52 3.7
06PA04-13 12 0.48 0.21
06PA04-13 19 1.04 0.77
06PA04-13 26 0.82 1.5
06PA04-13 29 2.08 2.6
06PA04-13 36 2.6 3.7
06PA05-14 11 0.42 0.21
06PA05-14 18 0.94 0.77
06PA05-14 25 0.73 1.5
06PA05-14 28 2.16 2.6
06PA05-14 35 2.4 3.7
06PA06-14 11 0.42 0.21
06PA06-14 18 0.94 0.77
06PA06-14 25 0.81 1.5
06PA06-14 28 2.16 2.6
06PA06-14 35 2.8 3.7
06PA07-14 13 0.53 0.21
06PA07-14 20 1.14 0.77
06PA07-14 27 0.89 1.5
06PA07-14 30 2.09 2.6
06PA07-14 37 2.75 3.7
06PA08-14 13 0.53 0.21
06PA08-14 20 1.14 0.77
06PA08-14 27 0.91 1.5
06PA08-14 30 2.11 2.6
06PA08-14 37 2.82 3.7
06PB01-13 10 0.37 0.21
06PB01-13 17 0.84 0.77
06PB01-13 24 1 1.5
06PB01-13 31 2.2 2.6
06PB01-13 34 3.23 2.6
06PB01-13 41 4.48 3.7
06PB02-13 10 0.37 0.21
06PB02-13 17 0.84 0.77
06PB02-13 24 0.6 1.5
06PB02-13 31 1.61 2.6
06PB02-13 34 3.23 2.6
06PB02-13 41 3.5 3.7
06PB03-13 11 0.42 0.21
06PB03-13 18 0.94 0.77
06PB03-13 25 0.85 1.5
06PB03-13 28 2.16 2.6
06PB03-13 35 3 3.7
06PB04-13 11 0.42 0.21
06PB04-13 18 0.94 0.77
06PB04-13 25 0.73 1.5
06PB04-13 28 2.16 2.6
06PB04-13 35 2.5 3.7
06PB05-13 11 0.42 0.21
06PB05-13 18 0.94 0.77
06PB05-13 25 0.85 1.5
06PB05-13 28 2.3 2.6
06PB05-13 35 3 3.7
06PB06-13 11 0.42 0.21
06PB06-13 18 0.94 0.77
06PB06-13 25 1 1.5
06PB06-13 28 2.16 2.6
06PB06-13 35 2.8 3.7
06PB07-13 13 0.53 0.21
06PB07-13 20 1.14 0.77
06PB07-13 27 0.75 1.5
06PB07-13 30 0.95 2.6
06PB07-13 37 2.5 3.7
06PB08-14 13 0.53 0.21
06PB08-14 20 1.14 0.77
06PB08-14 27 0.9 1.5
06PB08-14 30 1.2 2.6
06PB08-14 37 3.5 3.7
06PC07-13 7 0.22 0.21
06PC07-13 14 0.59 0.77
06PC07-13 21 1.24 1.5
06PC07-13 24 0.88 1.5
06PC07-13 31 2 2.6
06PC08-13 13 0.19 0.21
06PC08-13 20 0.19 0.77
06PC08-13 23 0.19 1.5
I want the data to be like these
+------------+------------+------------+------------+------------+--------+
| 01PA05-18 | 01PA06-18 | 01PA07-18 | 01PA08-18 | 01PA09-18 | Target |
+-----+------+-----+------+-----+------+-----+------+-----+------+--------+
| DOC | ABW | DOC | ABW | DOC | ABW | DOC | ABW | DOC | ABW | ABW |
+-----+------+-----+------+-----+------+-----+------+-----+------+--------+
| 6 | 0 | 5 | 0 | 5 | 0 | 5 | 0 | 5 | 0 | 0.2 |
| 13 | 0.53 | 12 | 0.48 | 12 | 0.48 | 12 | 0.48 | 12 | 0.48 | 0.77 |
| 20 | 1.14 | 19 | 1.04 | 19 | 1.04 | 19 | 1.04 | 19 | 1.04 | 1.5 |
| 27 | 0.92 | 26 | 0.74 | 26 | 0.72 | 26 | 0.7 | 26 | 0.71 | 2.6 |
| 34 | 1.49 | 33 | 1.25 | 33 | 1.32 | 33 | 1.30 | 33 | 1.22 | 3.7 |
| 41 | 1.91 | 40 | 1.82 | 40 | 1.84 | 40 | 1.80 | 40 | 1.85 | 4.8 |
| 48 | 2.64 | 47 | 3.12 | 47 | 3.05 | 47 | 3.07 | 47 | 2.90 | 5.9 |
| 55 | 3.69 | 54 | 4.40 | 54 | 4.12 | 54 | 3.72 | 54 | 3.74 | 7 |
| 62 | 4.19 | 61 | 5.44 | 61 | 5.21 | 61 | 4.52 | 61 | 4.40 | 8.1 |
| 65 | 4.72 | 64 | 6.46 | 64 | 6.00 | 64 | 5.11 | 64 | 4.92 | 9.2 |
| 72 | 5.74 | 71 | 7.30 | 71 | 6.90 | 71 | 5.87 | 71 | 5.78 | 10.3 |
+-----+------+-----+------+-----+------+-----+------+-----+------+--------+
try using case
Case when PondCrop =01PA03-18
then //your code
else //your code
end case as 01PA03-18