Showing posts with the label Discard method

Featured Post

8 Ways to Optimize AWS Glue Jobs in a Nutshell

  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 Delete an Item from a Set in Python: Best Example

Set is a built-in data type in Python. Furthermore, it is an unordered collection without duplicate items. Here are the two methods that explain to delete an item from a Set. Methods to delete an item from a Set discard remove Discrd Vs. Remove discard() will not raise an error if the item to remove does not exist. The remove() will raise an error if the item does not exist. Explanation to discard and remove methods Python program: #Prints all the Set items food = {"pasta", "burger", "hot dog", "pizza"} print(food) # Prints the Set items without pasta food.discard("pasta") print(food) # Prints the Set items without burger and pasta food.remove("burger") print(food) # The next two lines try to remove an item that isn't in the set! food.discard("pasta")  # this will not report an error food.remove("pasta")   # this will report an error The output: {'pasta', 'burger', 'pizza', '