You are likely getting a different number of entries due to your logic grabbing more elements than you meant. I imagine your company name function is being too liberal with the <tr> tags it is grabbing. I simplified the logic here using CSS selectors as that is usually my preferred approach, but feel free to restructure for a find_all if preferred.
The idea is to target the tables directly after a header div, which are marked with the class mw-heading. Then we just grab the table rows with <td> elements (skipping the header rows which have <th>) and specifically grabbing either the first or the second <td> depending on which column we want. For the ticker, we filter by the href starting with the desired URL prefix.
def column_ticker_func(soup): elements = soup.css.select('div.mw-heading + table tr > td:nth-child(1) > a[href^="https://www.nseindia.com/get"]') return [element.text.strip() for element in elements] # function to get the corresponding company name def column_company_name_func(soup): elements = soup.css.select('div.mw-heading + table tr > td:nth-child(2)') return [element.text.strip() for element in elements]With this logic, we get 1815 for both.