unexpected indent错误

unexpected indent是缩进错误:

def get_train_test(test_size=0.95):
  """Split Data into train ans test sets."""
   y = 1*(df.cand_pty_affiliation =='REP')
    X = df.drop(["cand_pty_affiliation"], axis=1)

改成以下即可

def get_train_test(test_size=0.95):
    """Split Data into train ans test sets."""
    y = 1*(df.cand_pty_affiliation =='REP')
    X = df.drop(["cand_pty_affiliation"], axis=1)

你可能感兴趣的:(python)