Posts

Showing posts with the label 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

How to Access Dictionary Key-Value Data in Python

Image
Use for-loop to read dictionary data in python. Here's an example of reading dictionary data. It's helpful to use in real projects. Python program to read dictionary data yearly_revenue = {    2017 : 1000000,    2018 : 1200000,    2019 : 1250000,    2020 : 1100000,    2021 : 1300000,  } total_income = 0 for year_id in yearly_revenue.keys() :   total_income+=yearly_revenue[year_id]   print(year_id, yearly_revenue[year_id]) print(total_income) print(total_income/len(yearly_revenue)) Output 2017 1000000 2018 1200000 2019 1250000 2020 1100000 2021 1300000 5850000 1170000.0 ** Process exited - Return Code: 0 ** Press Enter to exit the terminal Explanation The input is dictionary data. The total revenue sums up for each year. Notably, the critical point is using the dictionary keys method. References Python in-depth and sample programs