As im tring to fetch specific data based on u_id for ploting graph and predicting market rate.For Example: I have 1000 data in my excel sheet and the U_ID is 5 i want to fetch U_ID 5th entire data. My Data Format is..
Above Screen shot is my excel format input data and i want to fetch data based on U_ID..if the U_ID is 2 means i want to fetch all data includes P_ID,Products(Spoons,cups),Product Quantity,Total amount,location,date.
i tried but still i did not get my expected output.
import pandas as pd from pandas import DataFrame as df from pandas import * import matplotlib.pyplot as plt from selenium.webdriver.common import by excel_file = 'FIRST1.xls' mov = pd.read_excel(excel_file) # print(mov) DataFrame(mov, columns=["SNO", "U_ID", "P_ID", "SUBPRODUCTS", "PRODUCT QUANTITY", "TOTAL AMOUNT", "LOCATION", "DATE"]) mov.sort_values(by="U_ID", inplace=True) # df.sort_values(by='PURCHASE AMOUNT') print (mov.iloc) getda = mov.iloc gd = getda od = getda
It give the data as sorted form..Any one help me..
Thanks In Advance
import pandas as pd import matplotlib.pyplot as plt excel_file = 'FIRST1.xls' df = pd.read_excel(excel_file) df.columns = ["SNO", "U_ID", "P_ID", "SUBPRODUCTS", "PRODUCT QUANTITY", "TOTAL AMOUNT", "LOCATION", "DATE"] getda = df[df.U_ID == 2].values # <- .values gives you the values of your data row as a list! gd = getda od = getda
If you have more than one row that meets the condition then interate over the results (which is a list of lists):
for row in getda: gd = row od = row