I want to include 2 DataFrames into 1 csv.
My code runs and it prints the 2 DataFrames, however I wanna remove the blank space in columns D,E.F row 2, so that the information in line 3 appears right under its headers.
The DATA is correct and all, just formatting is my question here.
(This will make sense if you run the code, very small file)
import pandas as pd
from bs4 import BeautifulSoup
import csv
import requests
line1=[]
url='https://clinicaltrials.gov/ct2/show/NCT03548207'
r=requests.get(url)
soup=BeautifulSoup(r.content,'html.parser')
content=soup.find_all('div',id='main-content')
for item in content:
title=item.find('h1',class_='tr-h1 ct-sans-serif tr-solo_record').text
sponsor=item.find('div', class_='tr-info-text').text
summary=item.find('div',class_='ct-body3 tr-indent2').text
dict={'Title':title,'Sponsor':sponsor,'Summary':summary}
line1.append(dict)
df=pd.DataFrame(line1)
url2='https://clinicaltrials.gov/ct2/show/NCT03548207'
table1=pd.read_html(url2)[2]
dj=pd.DataFrame(table1)
kk=df.append(dj)
kk.to_csv('çode11.csv',index=False)