过滤Panda DataFrame

时间:2017-10-12 22:25:08

标签: python pandas

import pandas as pd
import numpy as np
df = pd.DataFrame(
      {
        'Country' : ['USA','Canada','Mexico'],
       'City' : ['Houston','Ottawa','Leon'],
       'Capital' : ['N','Y','N']
    }
) 
df.where(df.Capital =='Y')

如何只获得满足条件的行?

enter image description here

0 个答案:

没有答案