colab , image to text , (rows to coloum adjustment is required),

rank logic

21st april, 25 ennadu article.



=(D2*0.9)+(E2*0.6)+(F2*0.3)

                                                                                                                                963 rank   normal rank


--------------------- 

నిప్పాన్‌ ఇండియా లార్డ్‌ క్యాప్‌ ఫండ్‌ 19.06% 27.18% 14.28% 0.6052 0.37746 37.746 1 1

డీఎస్‌పీ టాప్‌ [00 ఈక్విటీ ఫండ్‌, 18.43% 22.80% 11.78% 0.5301 0.33801 33.801 3 4

ఐసీఐసీఐ ప్రుడెన్నియల్‌ బ్లూచిప్‌ ఫండ్‌ 17.08% 25.25% 14.17% 0.565 0.34773 34.773 2 2

హెచ్‌డీఎఫ్‌సీ లార్డ్‌ క్యాప్‌ ఫండ్‌ 16.31% 24.53% 12.79% 0.5363 0.33234 33.234 4 3

బరోడా జీఎన్‌పీ పారిబాన్‌ లార్డ్‌ క్యాప్‌ ఫండ్‌ 15.78% 22.49% 13.00% 0.5127 0.31596 31.596 7 9

తర యు లక్‌ రక్‌ 15.64% 23.83% 13.51% 0.5298 0.32427 32.427 5 5

ఎడిల్‌వైజ్‌ లార్డ్‌ క్యాప్‌ ఫండ్‌ 15.48% 23.39% 13.07% 0.5194 0.31887 31.887 6 7

కెనరా రొబెకో బ్లూచిప్‌ ఈక్విటీ ఫండ్‌ 15.17% 22.65% 14.30% 0.5212 0.31533 31.533 8 6

జేఎం లార్డ్‌ క్యాప్‌ ఫండ్‌: 15.11% 19.82% 11.20% 0.4613 0.28851 28.851 15 16

బంధన్‌ లార్డ్‌ క్యాప్‌ ఫండ్‌ 14.92% 22.86% 12.52% 0.503 0.309 30.9 10 10

కోటక్‌ బ్లూచిప్‌ ఫండ్‌ 14.62% 23.67% 13.33% 0.5162 0.31359 31.359 9 8

ఆదిత్యా బిర్లా సన్‌లైఫ్‌ ఫ్రంట్‌లైన్‌ ఈక్విటీ ఫండ్‌ 14.34% 23.24% 12.54% 0.5012 0.30612 30.612 11 11

టాటా లార్డ్‌ క్యాప్‌ ఫండ్‌, 14.01% 23.37% 12.49% 0.4987 0.30378 30.378 12 12

హెచ్‌ఎస్‌బీసీ లార్డ్‌ క్యాప్‌ ఫండ్‌, 13.89% 21.41% 12.41% 0.4771 0.2907 29.07 14 14

ఎస్‌బీవి బ్లూచివ్‌ ఫండ్‌ 13.65% 22.76% 12.76% 0.4917 0.29769 29.769 13 13

రోలర్‌ కాన్‌ రాండ్‌ 13.31% 19.96% 12.09% 0.4536 0.27582 27.582 18 18

ఫ్రాంక్లిన్‌ ఇండియా బ్లూచిప్‌ ఫండ్‌, 12.77% 21.45% 11.31% 0.4553 0.27756 27.756 16 17

Sooo ఇండియా లార్డ్‌ క్యాప్‌ ఫండ్‌ 12.59% 20.26% 11.33% 0.4418 0.26886 26.886 19 20

'టారన్‌ లార్డ్‌ క్యాప్‌ ఫండ్‌ 12.57% 19.95% 9.44% 0.4196 0.26115 26.115 21 22

మిరే అసెట్‌ లార్డ్‌ క్యాప్‌ ఫండ్‌ 11.85% 21.46% 13.56% 0.4687 0.27609 27.609 17 15

'యూటీవి లార్డ్‌ క్యాఫ్‌ ఫండ్‌ 11.39% 21.25% 11.80% 0.4444 0.26541 26.541 20 19

ఎల్‌ఐసీ ఎంఎఫ్‌ లార్డ్‌ క్యాప్‌ ఫండ్‌ 11.21% 19.60% 11.19% 0.42 0.25206 25.206 22 21

యాక్సిస్‌ బ్లూచిప్‌ ఫండ్‌ 10.39% 17.86% 12.74% 0.4099 0.23889 23.889 23 23


# Step 1: Install Dependencies

!apt-get update -qq

!apt-get install -y tesseract-ocr tesseract-ocr-tel

!pip install -q pytesseract openpyxl Pillow


# Step 2: Import Modules

import pytesseract

from PIL import Image

import pandas as pd

import re


# Step 3: Set Image Path (replace with your file name if different)

image_path = "/content/123.jpg"


# Step 4: Load Image

img = Image.open(image_path)


# Step 5: Extract Text (Telugu + English)

raw_text = pytesseract.image_to_string(img, lang='tel+eng')

print("🔍 Raw Text:\n", raw_text)


# Step 6: Extract Data Using Regex

lines = raw_text.split('\n')

data = []


for line in lines:

    line = line.strip()

    if not line:

        continue


    # Match fund name followed by 3 percentages

    match = re.search(r"^(.*?)(\d+\.\d+%)\s+(\d+\.\d+%)\s+(\d+\.\d+%)", line)

    if match:

        fund_name = match.group(1).strip()

        year_1 = match.group(2)

        year_3 = match.group(3)

        year_5 = match.group(4)

        data.append([fund_name, year_1, year_3, year_5])


# Step 7: Save to Excel

if data:

    df = pd.DataFrame(data, columns=["Fund Name", "1 Year", "3 Year", "5 Year"])

    excel_path = "/content/cleaned_fund_data.xlsx"

    df.to_excel(excel_path, index=False)

    print("\n✅ Extracted Data:\n")

    print(df)

    print(f"\n📁 Excel file saved at: {excel_path}")

else:

    print("⚠️ No matching data found. Please check the image clarity or OCR output.")

------------

# Step 1: Install Tesseract and Required Packages
!apt-get update
!apt-get install -y tesseract-ocr tesseract-ocr-tel
!pip install pytesseract openpyxl Pillow

# Step 2: Import libraries
import pytesseract
from PIL import Image
import pandas as pd
import re

# Step 3: Load the image (replace filename as needed)
image_path = "/content/123.jpg"  # Replace with your actual file
img = Image.open(image_path)

# Step 4: OCR using both Telugu and English languages
raw_text = pytesseract.image_to_string(img, lang='tel+eng')

# Step 5: Extract lines with percentages (expecting 3 % values)
lines = raw_text.split('\n')
data = []

# Step 6: Use regex to extract expected pattern
for line in lines:
    line = line.strip()
    if not line:
        continue
    # Match fund name + 3 % values
    match = re.match(r"^(.*?)(\d+\.\d+%)\s+(\d+\.\d+%)\s+(\d+\.\d+%)", line)
    if match:
        fund_name = match.group(1).strip()
        one_year = match.group(2)
        three_year = match.group(3)
        five_year = match.group(4)
        data.append([fund_name, one_year, three_year, five_year])

# Step 7: Convert to DataFrame
df = pd.DataFrame(data, columns=["Fund Name", "1 Year", "3 Year", "5 Year"])

# Step 8: Save to Excel
output_path = "/content/cleaned_fund_data.xlsx"
df.to_excel(output_path, index=False)
print(f"✅ Extracted table saved to: {output_path}")

# Optional: show the extracted data
df.head()


Popular posts from this blog

SAP CPI : camle expression in sap cpi , cm, router, filter and groovy script. format

pss book: గురు ప్రార్థనామంజరి . completed 21st july 2024

pss book : శ్రీకృష్ణుడు దేవుడా, భగవంతుడా completed , second review needed. 26th April 2024