Avatar ·

How to delete rows based on different conditions?

📁 Advanced Python Topics, numpy, pandas

There is a dataframe and I need to delete rows where the value in column A is greater than 50. This operation is successfully performed by the code:

import pandas as pdimport numpy as npdf = pd.DataFrame([[256, 4, 24, 51], [24, 25, 34, 200], [300, 12, 45, 11],
                   [34, 19, 2, 34], [

                    
                
Avatar ·
keys = {'name', 'from', 'to'}valid_tour = list(filter(lambda d: d.keys() == keys, tour))print(valid_tour)# ({'name': 'Alexander', 'from': 'Moscow', 'to': 'Kazan'},#  {'name': 'Alice', 'from': 'Moscow', 'to': 'Kazan'})

Log in to leave an answer

Blogs