<jupyter_start><jupyter_text>6. Write a program to scrap details of all the funding deals for second quarter (i.e. July 20 – September 20) from trak.in.<jupyter_code>#Connect to web driver
driver=webdriver.Chrome(r"D://chromedriver.exe")  #r converts string to raw string
#If not r, we can use executable_path = "C:/path name"
#Getting the website to driver
driver.get('https://trak.in/')

#When we run this line, automatically the webpage will be opened
#Getting the Funding Deals details by fetching the link
funding_deals=driver.find_element_by_xpath("//li[@id='menu-item-51510']/a").get_attribute('href')
driver.get(funding_deals)
#Taking the empty lists of the details to be scraped
Date=[]
Startup=[]
Industry=[]
SubVertical=[]
Location=[]
Investor=[]
Investment=[]
Amount=[]

#For quarter July 20 - September 20, the range numbers are between 48-51. So we will consider that range and scrap data
for i in range(48,51):
    driver.find_element_by_xpath("//div[@id='tablepress-{}_wrapper']/div/label/select/option[4]".format(i)).click()
#As the tablepress value differs for each quarter, we are iterating in the for loop and converting into raw string using format
    
    #Scrapping date data from the webpage
    date=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[2]".format(i))
    for d in date:
        Date.append(d.text)
        
    #Scrapping startup details data from the webpage
    startup=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[3]".format(i))
    for s in startup:
        Startup.append(s.text)
        
    #Scrapping Industry details data from the webpage
    industry=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[4]".format(i))
    for ind in industry:
        Industry.append(ind.text)
        
    #Scrapping Subvertical details data from the webpage
    sv=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[5]".format(i))
    for s in sv:
        SubVertical.append(s.text)
        
    #Scrapping Location details data from the webpage
    location=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[6]".format(i))
    for l in location:
        Location.append(l.text)
        
    #Scrapping Investor details data from the webpage
    investor=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[7]".format(i))
    for inv in investor:
        Investor.append(inv.text)
        
    #Scrapping Investment type details data from the webpage
    investment=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[8]".format(i))
    for it in investment:
        Investment.append(it.text)
        
    #Scrapping the amount data from the webpage
    amount=driver.find_elements_by_xpath("//table[@id='tablepress-{}']/tbody/tr/td[9]".format(i))
    for a in amount:
        Amount.append(a.text)
#Creating a dataframe for saving the extracted data
trak_fund=pd.DataFrame({})
trak_fund['Date']=Date
trak_fund['Startup']=Startup 
trak_fund['Industry']=Industry
trak_fund['SubVertical']=SubVertical
trak_fund['Location']=Location
trak_fund['Investor']=Investor
trak_fund['Investment']=Investment
trak_fund['Amount']=Amount

#Checking the dataframe
trak_fund
#Closing the driver
driver.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13293051359516617, 'fraction_numerical': 0.009365558912386707, 'mean_word_length': 4.323151125401929, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '411019', 'license': 'MIT', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1083, 'n_words': 265, 'path': 'Webscraping/Trak.in/TrakData_Webscraping.ipynb', 'repo_name': 'Jerish7/FlipRoboTechnologies-Internship', 'size': '3310'}