python - Print value from a DataFrame (wrong output, need only 1 item from a DataFrame) -
i have for
loop going find matching values 2 dataframes. list read:
index, row in output_merged_po.iterrows(): stock = output_merged_stock[output_merged_stock['pn_stripped'] == row['pn_stripped']][['whs']] print stock
in results when pn matches:
whs 111 vko 1111 vko 1112 zzz
so if put
if stock.iloc[0:3]['whs'].values[0] == '_': print stock
or
if any(stock['whs'] == 'vno'): print stock
i result above:
whs 111 vko 1111 vko 1112 zzz
where need see 111 , 1111 lines whs vko.
however, if write second whs name (zzz):
if stock.iloc[0:3]['whs'].values[0] == 'zzz': print stock
i empty line, no info printed, while want see
whs 1112 zzz
to printed.
how possible solve problem , see line/lines needed see?
Comments
Post a Comment