hotshotgg

导航

pandas,numpy ,np.logical_and,or,not

# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)

# Import numpy, you'll need this
import numpy as np

# Create medium: observations with cars_per_cap between 100 and 500
cars_per_cap = cars['cars_per_cap']
medium = np.logical_and(cars_per_cap>100,cars_per_cap<500)


# Print medium
print(cars[medium])

posted on 2024-07-25 16:42  hotshotgg  阅读(4)  评论(0编辑  收藏  举报