I'm new to Python and was confused as to why the following pandas queries are producing two different outputs. I specifically don't understand why the first query has already filtered out the False values. I also don't understand why it's in a different structure.
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)
dr = cars['drives_right']
sel = [cars[dr]]
print(sel)
[ cars_per_cap country drives_right
US 809 United States True
RU 200 Russia True
MOR 70 Morocco True
EG 45 Egypt True]
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)
dr = cars['drives_right']
sel = [[dr]]
print(sel)
[[US True
AUS False
JPN False
IN False
RU True
MOR True
EG True
Name: drives_right, dtype: bool]]