Bir kategori işim vardı excele çevirmeyi denedim böyle bir sonuç vermeye başladı

Analiz hatası
import fitz  # PyMuPDF

# Read the PDF file using PyMuPDF
pdf_document = fitz.open(pdf_path) pdf_text = ""


# Extract text from each page of the PDF
for page_num in range(len(pdf_document)):    page = pdf_document.load_page(page_num)    pdf_text += page.get_text("text") + "n"


# Split the text into lines for better processing
lines = pdf_text.split('n')
# Group categories manually since there is no clear structure in the PDF text
groups = {} current_group = None


for line in lines:    # Check if the line looks like a group header    if line.isupper() and len(line) > 2:  # simplistic check for group headers        current_group = line.strip()        groups[current_group] = []    elif current_group: groups[current_group].append(line.strip())

# Remove empty strings from the category lists
for group in groups:    groups[group] = [category for category in groups[group] if category]

# Create DataFrame from the grouped categories
data = []
for group, categories in groups.items():    for category in categories: data.append([group, category])
df = pd.DataFrame(data, columns=["Grup Adı", "Kategori"])

# Save the DataFrame to an Excel file
output_file_complete = "/mnt/data/Google_Isletme_Kategorileri_Complete.xlsx"
df.to_excel(output_file_complete, index=False)
output_file_complete
It seems like I can’t do more advanced data analysis right now. Please try again later.

import fitz  # PyMuPDF

# Read the PDF file using PyMuPDF
pdf_document = fitz.open(pdf_path)
pdf_text = ""


# Extract text from each page of the PDF
for page_num in range(len(pdf_document)):
    page = pdf_document.load_page(page_num)
    pdf_text += page.get_text("text") + "\n"


# Split the text into lines for better processing
lines = pdf_text.split('\n')


# Group categories manually since there is no clear structure in the PDF text
groups = {}
current_group = None


for line in lines:
    # Check if the line looks like a group header
    if line.isupper() and len(line) > 2:  # simplistic check for group headers
        current_group = line.strip()
        groups[current_group] = []
    elif current_group:
        groups[current_group].append(line.strip())


# Remove empty strings from the category lists
for group in groups:
    groups[group] = [category for category in groups[group] if category]


# Create DataFrame from the grouped categories
data = []
for group, categories in groups.items():
    for category in categories:
        data.append([group, category])


df = pd.DataFrame(data, columns=["Grup Adı", "Kategori"])


# Save the DataFrame to an Excel file
output_file_complete = "/mnt/data/Google_Isletme_Kategorileri_Complete.xlsx"
df.to_excel(output_file_complete, index=False)
output_file_complete