Posts

Showing posts with the label python-dictionary

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

Python Subset: How to Get Subset of Dictionary

Image
Here's a sample program to get the python subset. In this case, you'll find logic for dictionary subsets. Dictionary python To illustrate, I have taken a dictionary as below with keys and values. my_first_dict = { 'HP': 100 'IBM': 200 'NTT': 300 'ABC': 400 'GDF': 500 } I want to make a subset of values greater than 100 and less than 400. How can you achieve this? No worries, below, you will find the logic. Logic to get subset out of a dictionary I am using dictionary comprehension to achieve this. Syntax: sub_set = { key:value for key, value in my_first_dict.items() value >100 and value <400} Result References Python Programming: Using Problem-Solving Approach