I have series like so:
d = {'a': 0, 'b': 1, 'c': 22, 'd': 537, 'e': 537, 'f': 0}
s = pd.Series(d)
I'd like to assign conditions so that:
NB: len(df) = 537
if x=0: "E"
if x=537: "F"
if 0<x<537: "P"
I have the following:
df_len = len(df.index)
no_of_na_empty = df.isna().sum()
rslt_df = no_of_na_empty.loc[(no_of_na_empty > 0) & (no_of_na_empty < df_len)]
no_of_na_empty = no_of_na_empty[rslt_df]
no_of_na_empty = no_of_na_empty.mask(rslt_df, other="P")
no_of_na_empty = no_of_na_empty.replace(to_replace=0, value="F")
no_of_na_empty = no_of_na_empty.replace(to_replace=df_len, value="E")
However this doesn't work (for the condition if 0<x<537: "P"). The output should be:
d = {'a': "E", 'b': "P", 'c': "P", 'd': "F", 'e': "F", 'f': "E"}
s = pd.Series(d)```