I need to do two columns web scraption with python
Question:
<div class="content">
<div class="container">
<div class="row pt-2">
<div class="col pe-1">
<div class="grid-cell p-2">
<a href="united-states_florida/company/met-west-commercial-lender/tom-mchugh-975">
Tom Mchugh
</a>
</div>
</div>
<div class="col ps-1">
<div class="grid-cell p-2">
Company:
<span>
<a href="united-states_florida/company/met-west-commercial-lender">
Met West Commercial Lender
</a>
</span>
</div>
</div>
</div>
My result showing like this
I want to look like following table:
Column A
Column B
Tom Mchugh
Met West Commercial Lender
Answers:
There might be different approaches. Here is an elegant one.
y = df.Name.values
df = pd.DataFrame({'A' : y[::2], 'B' : y[1::2]})
<div class="content">
<div class="container">
<div class="row pt-2">
<div class="col pe-1">
<div class="grid-cell p-2">
<a href="united-states_florida/company/met-west-commercial-lender/tom-mchugh-975">
Tom Mchugh
</a>
</div>
</div>
<div class="col ps-1">
<div class="grid-cell p-2">
Company:
<span>
<a href="united-states_florida/company/met-west-commercial-lender">
Met West Commercial Lender
</a>
</span>
</div>
</div>
</div>
My result showing like this
I want to look like following table:
Column A | Column B |
---|---|
Tom Mchugh | Met West Commercial Lender |
There might be different approaches. Here is an elegant one.
y = df.Name.values
df = pd.DataFrame({'A' : y[::2], 'B' : y[1::2]})