![]() |
Pandas default index remove - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Pandas default index remove (/thread-31678.html) |
Pandas default index remove - nio74maz - Dec-27-2020 Hi everyone I'm trying to put a Put on woocommerce I extracted the product_id from a csv now I should pass it to the put method documentation: https: //woocommerce.github.io/woocommerce-rest-api-docs but I get this error: {'code': 'rest_no_route', 'message': "No route provides a match between the URL and the requested method.", 'data': {'status': 404}} I tried to print the result it should be 774 but I see that it also returns the default index of the Dataframe that is: 0 | 774 I have to remove that index, I think that's the problem my code: from woocommerce import API import pandas as pd def update(id): data = { "stock_quantity": "0" } print(wcapi.put("products/"+id, data).json()) wcapi = API( url="https://---------", consumer_key="ck_e985f38b7c-------", consumer_secret="cs_e03fab956a2835990e0----------", wp_api=True, version="wc/v3" ) df1 = pd.read_csv('eurogold.csv', index_col=0) df1 = df1.drop_duplicates(['codbar']) # elimina duplicati df1['codbar'] = df1['codbar'].astype(str) print(df1) df2 = pd.read_csv('woo.csv', index_col=0) df2 = df2.dropna().reset_index(drop=True) print(df2) risultato = df2[df2.sku.isin(df1.codbar)].astype(str) for index, row in risultato.iterrows(): update(risultato.product_id) RE: Pandas default index remove - nio74maz - Dec-27-2020 in debug mode id should be 744 but instead 0,744 ![]() RE: Pandas default index remove - nio74maz - Dec-27-2020 what a fool I was wrong to iterate def update(id): data = { "stock_quantity": "1" } print(wcapi.put("products/" + id, data).json()) df1 = pd.read_csv('eurogold.csv', index_col=0) df1 = df1.drop_duplicates(['codbar']) # elimina duplicati df1['codbar'] = df1['codbar'].astype(str) print(df1) df2 = pd.read_csv('woo.csv', index_col=0) df2 = df2.dropna().reset_index(drop=True) print(df2) risultato = df2[df2.sku.isin(df1.codbar)].astype(str) for index, row in risultato.iterrows(): update(row['product_id']) |