I am trying to apply a .str[] to a pandas data from so I can get specific characters from a string but I get a "SettingWithCopyWarning" error.
import pandas as pd
df_temp = pd.read_csv("C:\\Users\\Bill-PC\\PycharmProjects\\QC Data\\Testing\\10 PP 1 2 again.txt", sep="\t", low_memory=False)
df_temp = df_initial.loc[df_initial["Sample Type"] == "Quality Control"]
df_temp["QC Level"] = df_temp["Sample Name"].str[-1:]
I get the following error
<input>:3: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead