Posts

Showing posts with the label Python IF-ELSE

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 Check If Statement Multiple Conditions in Python and Ensure Tidy Code

Image
Here're examples for Python multiple if conditions (statements). These are useful for interviews and projects. Many programmers confuse to write IF logic in Python. Below examples useful for your quick reference. Multiple IF Conditions IF, IF IF 'ELSE' IF 'or' IF 'and' Nested IF IF 'continue' IF 'break' In Python, the decision-making logic you can write with IF condition. You can write multiple IF conditions (Single way decision). At the same time, you can write IF and ELSE conditions (Two-way decision). Multiple IF conditions the best example. def main():         celsius = float(input("What is the Celsius temperature? "))         fahrenheit = 9/5 * celsius + 32         print("The temperature is", fahrenheit, "degrees Fahrenheit.")  # Print warnings for extreme temps         i f fahrenheit > 90:                print("It's really hot out there. Be careful!")         if fahrenheit < 30: