Franco Vera
Franco Vera

Reputation: 67

How can I solve this Isin problem? I cant make it

I'm having a problem, I try some stuff but i still Can't make it.

This is my DF.

enter image description here

But my problem is some steps ahead. Here its my code and then I explain:

df1 = df1.iloc[6:]
del df1['Unnamed: 0']
del df1['Unnamed: 3']
df1.rename(columns={'Unnamed: 1': 'Fecha', 'Unnamed: 2': 'Numero de Envio','Unnamed: 4': 'Zona', 'Unnamed: 5': 'Tarifa' }, inplace=True)
df1 = df1.replace('-', np.nan)
df1['Fecha'] = df1['Fecha'].ffill()
df1 = df1[df1['Numero de Envio'] != 143.97]
df1 = df1[df1['Numero de Envio'] != 113.97]
df1 = df1[df1['Numero de Envio'] != 243.37]
df2= pd.concat([df, df1], axis=1)
dfn=df2[["Numero de Envio","Unnamed: 13", 'Fecha']]
pd.options.display.float_format = '{:.0f}'.format
dfn.dropna()
dfn = dfn.astype('str')
diff = dfn['Numero de Envio'][~dfn['Numero de Envio'].isin(dfn['Unnamed: 13'])].dropna().tolist() 
print(f"\n Hay ventas que podrían no ser nuestras: \U0001F611 - Revisar :" '\n')
diff 

The output is:

 Hay ventas que podrían no ser nuestras: 😑 - Revisar :

['Ciudad vieja',
 'Jacinto vera ',
 'Bella Italia',
 'Colon',
 '41782431545',
 'Malvin',
 'Punta riels',
 'Nuevo París',
 'Punta carretas',
 'Aeropuerto',
 '41815769960',
 'Punta carretas',
 '41826206208',
 'Aguada',
 'Cordón']

The problem in question is that I need the info from the output and also the column called ''Fecha'' in the original DF I show above.

I would like a result like:

'Ciudad vieja', 2022-11-03 
 'Jacinto vera ',2022-11-04

and so on.

Hope you can help me! Best Wishes! PD: sorry for bad english!

Upvotes: 0

Views: 35

Answers (1)

Bushmaster
Bushmaster

Reputation: 4608

Can you try this:

diff = dfn[~dfn['Numero de Envio'].isin(dfn['Unnamed: 13'])].dropna()[['Numero de Envio','Fecha']].values.tolist() 

Upvotes: 1

Related Questions