jeudi 18 novembre 2021

"if" does not trigger when condition is met [duplicate]

I have the following block of code:

idatual=txt2['pvSystems'][x]['pvSystemId']
nomedocliente = txt2['pvSystems'][x]['name']
nomesclientes = pd.read_excel(file_loc, sheet_name="MONITORAMENTO", index_col=None, na_values=['NA'], usecols = "B")
y=0
print("name of the client: " + str(nomedocliente))
while y < len(nomesclientes):
    print("name of the client on the sheets: " + nomesclientes.iloc[y][0])
    if nomedocliente == nomesclientes.iloc[y][0]:

So, a few things worth noticing:

  • "nomedocliente",the first element on the comparisson, is taken from a response originated by a request.
  • The idea is to compare "nomedocliente" to the values of a colunm from a excell sheet, if the value is equal, we trigger an action.
  • Both values are strings.
  • The code works for the most values, but it doesn't work on very specific cases, like:

Case 1:

    name of the client: Pice e Cia
    name of the client on the sheets: Pice e Cia

Case 2:

    name of the client: Iolanda Saraiva Irecê
    name of the client on the sheets: Iolanda Saraiva Irecê
  • Problem cases don't have a pattern on them.

  • I've assured that those strings are equal, since they trigger if statements on other cases.

Any ideas ?

Aucun commentaire:

Enregistrer un commentaire