Posts

Showing posts with the label python-file-methods

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

6 Python file Methods Real Usage

Image
Files always have data in them. For different purposes, you need methods to deal with them. These six file methods of use in this case. Related:  5 top file modes in python. Python file methods Below are the top six file methods in python: Tell() Seek() Flush() Fileno() truncate() isatty() 1. tell() The usage of tell method is it  returns the cursor-position of the file-pointer from the beginning of the file. It tells the current cursor position. The position starts from zero, which is same as of an index. Syntax:  fileobject.tell() 2. seek() The usage of seek  method is cursor position, from one position to the specified position from the beginning of the file, it moves. Here, the cursor will be sought to a particular location. Syntax:  fileobject.seek(position) 3. flush() The usage of flush  method is clean out the internal buffer. Before writing the text in the file, it is best practice to clear out that the internal buffer can be cleared. Syntax:  fileobject.flush() 4. fileno() The