• 24-07-2024, 22:25:17
    #1
    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
  • 24-07-2024, 22:26:53
    #2
    hata değil hocam
  • 24-07-2024, 22:27:29
    #3
    canı istemeyince bazen kodu atıyor kendin yap diyo işte
  • 24-07-2024, 22:30:10
    #4
    Devoktay adlı üyeden alıntı: mesajı görüntüle
    canı istemeyince bazen kodu atıyor kendin yap diyo işte
    output_file_complete diyor ama bana excel dosyasını vermiyor "It seems like I can’t do more advanced data analysis right now. Please try again later." diyor.
  • 24-07-2024, 22:47:35
    #5
    Türkçe konuşmanı istiyorum yazın sonra aranızda çözersiniz. Hata değil bu. Tag kapatmıyor muhtemelen
  • 24-07-2024, 22:49:03
    #6
    hocam kendi yapamadığında kod yazıyor sen yap diye olay bu