city_df["Geography"].str.endswith("Quebec")
这是我的代码,它为我提供了真实和错误的列表。我想获取设置为true的城市的所有名称。
你几乎在那里。
mask = city_df["Geography"].str.endswith("Quebec")
quebec_city = city_df[mask]
提供一个更完整的示例可能会有所帮助。