Posts

Showing posts with the label File Formats

Featured Post

8 Ways to Optimize AWS Glue Jobs in a Nutshell

Image
  Improving the performance of AWS Glue jobs involves several strategies that target different aspects of the ETL (Extract, Transform, Load) process. Here are some key practices. 1. Optimize Job Scripts Partitioning : Ensure your data is properly partitioned. Partitioning divides your data into manageable chunks, allowing parallel processing and reducing the amount of data scanned. Filtering : Apply pushdown predicates to filter data early in the ETL process, reducing the amount of data processed downstream. Compression : Use compressed file formats (e.g., Parquet, ORC) for your data sources and sinks. These formats not only reduce storage costs but also improve I/O performance. Optimize Transformations : Minimize the number of transformations and actions in your script. Combine transformations where possible and use DataFrame APIs which are optimized for performance. 2. Use Appropriate Data Formats Parquet and ORC : These columnar formats are efficient for storage and querying, signif

How to Effectively Parse and Read Different Files in Python

Image
Here is Python logic that shows Parse and Read Different Files in Python. The formats are XML, JSON, CSV, Excel, Text, PDF, Zip files, Images, SQLlite, and Yaml. Python Reading Files import pandas as pd import json import xml.etree.ElementTree as ET from PIL import Image import pytesseract import PyPDF2 from zipfile import ZipFile import sqlite3 import yaml Reading Text Files # Read text file (.txt) def read_text_file(file_path):     with open(file_path, 'r') as file:         text = file.read()     return text Reading CSV Files # Read CSV file (.csv) def read_csv_file(file_path):     df = pd.read_csv(file_path)     return df Reading JSON Files # Read JSON file (.json) def read_json_file(file_path):     with open(file_path, 'r') as file:         json_data = json.load(file)     return json_data Reading Excel Files # Read Excel file (.xlsx, .xls) def read_excel_file(file_path):     df = pd.read_excel(file_path)     return df Reading PDF files # Read PDF file (.pdf) def rea