# ValueError: pos_label=1 is not a valid label: array(['N', 'Y'], dtype='<U1')

X = train_encoded_df.iloc[:, 1: ]
y = train_encoded_df["Loan_Status"]

print("Precision:",metrics.precision_score(y_test, y_pred))


My training data contains the categorical features encoded using get_dummies().

This is causing the error:

> ValueError: pos_label=1 is not a valid label: array(['N', 'Y'], dtype='U1')


How to fix this?

pos_label is an argument of scikit-learn's precision_score (docs); its purpose is, well, to indicate which label is the positive one and, if not given explicitly (like in your case here), it assumes the default value of 1 (again, check the docs).
Since it seems that the positive label in your case is 'Y', replace the last line with:
print("Precision:",metrics.precision_score(y_test, y_pred, pos_label='Y'))