1

I am new to phython and have very limited knowledge of it. I have a work related problem which i want to solve with python but i am not sure where to start.

Basically i have a list of over 2500 products that are stored in multiple branches. In some branches products are selling well whereas in others there is no demand and a risk of writing off stock if action is not taken ontime.

I have attached picture for example. I want to load data from excel and program in python, so it can recommend me materials and quantities to move from slow moving branches to branches that have demand.

Data in orange is plant requirement and data in green is excess which i am intending to move to plant that has demand.

Appreciate if you can help.

enter image description here

1
  • 2
    I will recommend you studying about pandas , it is a python library very usefull for csv and xlsx processing Commented Oct 20, 2020 at 8:25

2 Answers 2

1

You might find the Pandas library useful. It would allow you to:

Pandas is quite feature-rich, well-documented and user friendly.

Alternatively, if you need a lower-level interface, you can check out xlrd for older *.xls files or openpyxl (tends to work better, but only supports Excel 2010-present *.xlsx format).

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Anton. I will see check what options are there in pandas and how can I use them to solve above problem.
1

openpyxl is my favorite library for excel-python process. I've used it into my company project for importing and exporting data from towards excel.

Python library for reading and writing Excel (with extension xlsx/xlsm/xltx/xltm) files.

First, to install this package, you need to terminate this command:

sudo pip3 install openpyxl

Let's give you an example for how it works.

Input Excel File

Excel Demo Data

Python Code

Print the first column value

# importing openpyxl module 
import openpyxl 
  
# Give the location of the file 
path = "C:\\Users\\Admin\\Desktop\\demo.xlsx"
  
# workbook object is created 
wb_obj = openpyxl.load_workbook(path) 
  
sheet_obj = wb_obj.active 
m_row = sheet_obj.max_row 
  
# Loop will print all values 
# of first column  
for i in range(1, m_row + 1): 
    cell_obj = sheet_obj.cell(row = i, column = 1) 
    print(cell_obj.value)

OUTPUT

STUDENT 'S NAME
ANKIT RAI
RAHUL RAI
PRIYA RAI
AISHWARYA
HARSHITA JAISWAL

Reference: Reading an excel file using Python openpyxl module

4 Comments

Thanks Xavier but this will just give me first column and wont recommend how to move products around.
@mudassir, i put you the reference of my work. I just reference only one example of how this library package works. This packages is very flexible and unique. You can even import data from multiple sheet s and merge them together. Check the reference link and I'm sure you'll find what you're looking for.
You can apply edit, modify, and manipulate the excel data. I strongly recommend you to check the referenced link.
Thank you Sir. I shall check the reference link and see how it can help me in manipulating data the way I want it to be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.