FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version
I am building a model to train  it for binary classification. While processing the data before feeding it to the model i come across this warning
FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead.

Here is my code
import torch
import torch.nn as nn
import matplotlib.pyplot as pyp
import numpy as np 
import pandas as pd
from sklearn.metrics import confusion_matrix,accuracy_score
from sklearn.metrics import precision_score,recall_score,roc_curve,auc,roc_auc_score
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle

#loading the dataset
path='G:/My Drive/datasets/bank.csv'
df=pd.read_csv(path)
print(df.head(5))
print(df.shape)

#distirbuting the target values
print(&quot;Distribution of Target Values in Dataset -&quot;)
df.deposit.value_counts()

#check f we have na values in the datset
df.isna().sum()

#extracting columns whith strings
cartegorical_columns=df.select_dtypes(include='object').columns
print('cartegprical columns:',list(cartegorical_columns))

#for all cartegorical column if values in(yes/no) convert into a 1/10 flag
for col in cartegorical_columns:
    if df[col].nunique()==2:
        df[col]=np.where(df[col]=='yes',1,0)

print(df.head(5))

#for the remaining cartegorical values that have no binary values
#crate one hot encoded version of the dataset
new_df=pd.get_dummies(df)

#define the target and predictors for the model
target='deposit'
predictors=set(new_df.columns) - set([target])
print('new_df shape:',new_df.shape)
print(new_df[predictors].head())

The specific error
FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead.
  print(new_df[predictors].head())

What could be raising this error in my code and how can i solve it

you are trying to access the new_df with predictors which is set.
convert it to list.
example:
print(new_df[list(predictors)].head())

