Re: How to solve the given problem?
-ChrisA: You don't reply if you have problems. When I don't find any solution elsewhere then only I place in this group -Christian: One problem of different type requires the same elaboration. Q. What technique of statistics or numerical computation or general mathematics to use to solve this problem. Can you tell one example. Find the values of 푥subscript(푖) for i from 1 to n (n =100). 푥subscript(1) + 푥subscript(2) = 3, 푥subscript(푖+1) − 푥subscript(푖+2) = 1, 푓표푟 푖 = 1, … , 푛 − 2 푥subscript(n-1) + 푥subscript(n) = 3 -- https://mail.python.org/mailman/listinfo/python-list
How to solve the given problem?
Assume that there is a pattern of feeding for a special fish in a day (10 hours a day) as below: 150100303030202010 55 Today, the fish is fed in the second hour 60 unit instead of 100 unit Accidently. Implement some methods to distribute the remaining 40 unit in the rest of the day and propose the new patterns. Try to keep the distribution similar to the current feeding pattern. Note: pay attention that the total feeding amounts should be fix in a day. -- https://mail.python.org/mailman/listinfo/python-list
PermissionError: [Errno 13] Permission denied: 'Abc.xlsx'
When I enter data using Tkinter form in an Excel file when the excel file is closed there is no error but when I enter data using Tkinter form when the excel is already open following error comes: Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Dani Brothers\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__ return self.func(*args) File "D:/Python/Book Bank/New folder/PyCharm/Final/Excel.py", line 61, in SaveBook workbook.save(filename="BookBank.xlsx") File "C:\Users\Dani Brothers\Anaconda3\lib\site-packages\openpyxl\workbook\workbook.py", line 392, in save save_workbook(self, filename) File "C:\Users\Dani Brothers\Anaconda3\lib\site-packages\openpyxl\writer\excel.py", line 291, in save_workbook archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True) File "C:\Users\Dani Brothers\Anaconda3\lib\zipfile.py", line 1207, in __init__ self.fp = io.open(file, filemode) PermissionError: [Errno 13] Permission denied: 'Abc.xlsx' What to do to correct this error? I have already searched on google search many times but no solution was found. -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
What about CGI? Do you know any Library Management System based on CGI just like the one on Django? -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
On Sun, 23 Jan 2022 09:17:38 +1100, Chris Angelico <> declaimed the following: > >Absolutely agree with making a console app first. Though I rather >suspect the OP doesn't want to write any code at all. > I am not writing any code because I don’t know what code to do next. Still, I have made a dictionary now searching for what to do next in which one choice is MS SSIS and the second is numpy or pandas which AGross has written. If you want to see the code of making a dictionary then below it is: xyz = { col[0].value: [cell.value for cell in col[1:]] for col in sheet.columns } print(xyz) Now the problem is what to do next. If I had known, I must have submitted the whole project at my earliest convenience without coming over here in google groups. -Dennis Lee Bieber: > >And again... You will not find anything like you want... NOBODY is >going to write a web application using a spreadsheet as the primary data >storage. A spreadsheet, and custom transformation code, MIGHT be used to >initially populate a database. (M$ SQL Server Integration Services is a >whole system for defining import/transformation/clean-up "functions" for >data sources to data base). A spreadsheet might be available as a >report/extraction format from the database. > The problem is I don’t want Excel spreadsheet as a report/extraction format I want to UPDATE the Excel spreadsheet automatically with the latest values which are only in the two column cells and I don’t know which cells. Is it possible using SSIS? How you know so much about guns?? Why are you not in the favor of pandas if not openpyxl but if my problem is getting solved with MS SSIS then it's fine to leave openpyxl and pandas? Avi Gross: > >Now forget the plain text file and consider the following. Read the EXCEL file >one unit/cell at a time >in whatever column and row the data starts. This is doable, albeit not >necessarily ideal, and >basically can be the same algorithm with a substitution in the part that gets >the next line to getting >the cell below it. Testing for the end of the file may be different too. >But what I think makes a bit more sense is to set up the server to have a >rather long-term process >that sits there and waits for requests. It starts by reading all the data and >perhaps modifying it >once in the ways I suggest above. In python, you would now have some data >structure such as a >list or set or even dictionary or some variation from numpy or pandas. It does >not matter much. The >data structure holding all books, or maybe all unique book names, would be >there and ready and >waiting. >Your program now sleeps until woken up and it is given the book name being >searched for. It now >simply needs to apply whatever transformations you want to the received name >and then do one of >many kinds of lookup to see if it is in the data structure representing the >titles known to the library. >Using a set or dictionary means no search as it hashes the result and rapidly >finds out if it has >previously been stored. Other methods like lists have choices between a brute >force linear search if >the data remains in the original order or letting python do the work by asking >if it is "in" the list to >more sophisticated methods like keeping it sorted and doing a binary search. >I am guessing that for your need, a relatively unsophisticated method may work >fine and it can be >changed if your project scales up to millions of books and multiple people >searching at the same >time. > What you have written is difficult to find on google search and others. That's why writing all this to get something for search. -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
The user is going to enter the book name as the input of an HTML form on a website and I have to check whether the book is present or not in the Excel table. openpyxl preferred pandas is also fine anything left. Case sensitivity is not required. I tried to find code or tutorial on google search for all this but no use that's why.. This time the choice of HTML is right or not?? -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
- I will try to follow all that you people are saying, but it will take time or next time. The chance of concurrency is very less. Kindly don't write big descriptions. - The weblink Avi Gross has given is very useful. -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
Avi Gross: What does the website "https://mail.python.org/mailman/listinfo/python-list; do? Can I use this for the discussions which I require? -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
Avi Gross: -“They just were hoping someone would post complete code and they could then move on without learning anything.” This is due to the time factor -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
What Dennis Lee is saying I will see to it later. Right now what mrabarrnett is saying is of use. Why does the code written below is not giving any output? xls = ExcelFile('ABC.xlsx') df = xls.parse(xls.sheet_names[0], index_col=1) x=df.to_dict() print (x) Only the contents of the first column and the column number is required in the dictionary -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
- “if you are deploying to something like Heroku for the application -- the Excel file will have to be deployed also, and no one except your application will be able to see it there. Under this situation, there is no reason/excuse to keep the data in the very inefficient format you've defined in the most recent message. Import into some supported database and normalize the data to make updates easier.” Ok with deploying the Excel file also. Next time I will switch to another database. -“Well, you know how to read the contents of a cell, and how to put items into a dict (the key will be the cell contents and the value will be the column number).” No, I don’t know. I tried but still the same. -“The column numbers will go from 1 to sheet.last_column, although some of them might be empty (their value will be None), which you can remove from the dict afterward.” No need to do with the whole spreadsheet only the first column is enough -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
-“How are the relevant cells identified in the spreadsheet?” The column headings are: BOOK_NAME BOOK_AUTHOR BOOK_ISBN TOTAL_COPIES COPIES_LEFT BORROWER’S_NAME ISSUE_DATE RETURN_DATE -“It's often the case that the cells on the first row contain text as column labels.” These I have written above. -“If that's what you have in your spreadsheet, then read the cells on the first row for the column labels and put them in a dict to map from column label to column number.” This written above I do not understand how to code. -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
Using openpyxl is pretty straightforward: from openpyxl import load_workbook wb = load_workbook(spreadsheet_path) sheet = wb.active # Reading the values in cells: print('Cell A1 contains', sheet['A1'].value) print('Cell A2 contains', sheet['A2'].value) print('Cell B1 contains', sheet['B1'].value) # Alternatively: print('Cell A1 contains', sheet.cell(1, 1).value) print('Cell A2 contains', sheet.cell(1, 2).value) print('Cell B1 contains', sheet.cell(2, 1).value) """ The cell numbers (A1 or A2 or A3 or A4……… ) are not fixed they can be any. I don't know what the cell number is going to be that's what the problem is. The user is going to enter the book name in an HTML form present on a website then it will be checked whether the book user has entered is present or not in the Excel file. If the book is present in the book bank and the user requires that book then one will be issued to the user and the total number of books will be reduced by 1 (one) and the user or borrower’s name will be entered in the Excel’s table row in which the book name is present separated by a comma by other borrower names. The borrower's name can be more than one because more than one copies of the book are there as these are the books that are taught in schools. """ # Changing the value in a cell: sheet.cell(1, 20).value = 'TEST' # A value of None means that the cell is empty. wb.save(spreadsheet_path) wb.close() -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
-Whose time?? My time I do not have not time to switch to a database but if necessary I can use the database to make changes in Excel column entries. -No changes?? I cannot change the column names. -“maybe the point is that at any time one has to be able to re-export to the original excel format? (And why?? Do we actually need "reporting": then we can generate a PDF rather, otherwise we can just send out a CSV... etc.) Is that it?” PDF is not required and I am not doing any reporting at all. -“loading the data from the CSV file in memory into a pandas dataframe, working with that, and eventually saving back to the CSV file might be just enough... as long as there is never more than one user concurrently using the system, or you need also implement some concurrency management (you need that with a database, too, anyway): but that's tutorial number 2, and already quite less trivial, since to begin with it requires a more thorough analysis” No need to save the CSV file once the work is done CSV file will be exited without saving. If the above is going to work then I will be requiring something to see how to do all this that’s why written tutorial. For a more thorough analysis I have written once again what I want to do. Only the four functions that I have written below I have to make and that’s it. All the input will be entered by the user on a website: 1. First, I have to check in the Excel sheet or table whether the book user has entered is present in the book bank or not. 2. If a book is present and the quantity of the required book is greater than 0 (COPIES_LEFT column in excel file) and if the user wants the book, it will be assigned to the user which he will take from the book bank physically. When COPIES_LEFT is less than or equal to 0 the message will be “Book finished or not present”. 3. The quantity of the book in the Excel file will be reduced by 1 in the COPIES_LEFT column and the name of the borrower or user will be entered/added in the Excel file table or sheet already made and the column name is BORROWER’S NAME. 4. The borrower’s or user name can be more than one so they will be separated with a comma in the Excel file BORROWER’S NAME column. -1st save the data from excel as a CSV file you will find the CSV module makes these much easier to deal with, even if you do not import into a DB (although even then I would import into SQL- lite just for the benefits of the search algorithms) If in order to do the required task it is necessary to use SQLite and without using SQLite I cannot do what I want to do then I think I have to go for SQLite otherwise CSV looks to me as fine. To do everything using CSV I will be requiring a tutorial to see how to do all this. Anything not clear? -- https://mail.python.org/mailman/listinfo/python-list
Re: What to write or search on github to get the code for what is written below:
On Friday, 7 January 2022 at 02:59:17 UTC+5, alister wrote: > On Thu, 6 Jan 2022 10:55:30 -0800 (PST), NArshad wrote: > > > All this is going to be in python’s flask and HTML only > > > > 1. First, I have to check in the Excel sheet or table whether the book > > user has entered is present in the book bank or not. > > > Excel is the wrong application for storing this data - it should be in a > database > > 2. If a book is present and the quantity of the required book is greater > > than 0 (COPIES_LEFT column in excel file) and if the user wants the > > book, it will be assigned to the user which he will take from the book > > bank physically. When COPIES_LEFT will is less than or equal to 0 the > > message will be “Book finished or not present”. > Again Excel is not the correct application for processing this data > > > > 3. The quantity of the book in the Excel file will be reduced by 1 in > > the COPIES_LEFT column and the name of the borrower or user will be > > entered/added in the Excel file table or sheet already made and the > > column name is BORROWER’S NAME. > > > Database! > > 4. The borrower’s or user name can be more than one so they will be > > separated with a comma in the Excel file BORROWER’S NAME column. > > > Database > > > > - All functions mentioned above are to be deployed on the website > > pythonhow.com so make according to > > https://pythonhow.com/python-tutorial/flask/web-development-with-python- > and-flask/ > > > > - Do you know any other websites to deploy a python web application?? > > > > - No time to switch from Excel to anywhere else. Please do not make any > > changes to the Excel file. > > > > - Tutorials and repositories of the web for such problems are also > > required. The same is required for python (flask, Django...) also. > Sorry did not spot that this was a homework assignment > data should still be imported into a DB (a trivial task) It can be > exported back to a compatible format just as easily if hard copy output is > required > > > > > -- > "Rembrandt's first name was Beauregard, which is why he never used it." > -- Dave Barry As written no time to switch from excel to anywhere else but if a certain database is required to make changes in Excel’s cell values then which database to use (example Access or what) and after the right selection of the database, how to import data to a database and then export back to a compatible format that is to Excel cells…. I mean how to do this written below: “data should still be imported into a DB (a trivial task) it can be exported back to a compatible format just as easily if hard copy output is required” The reason I have written: “What to write on GitHub or on google search to find the necessary code to start with? “ I will also be requiring a code to start with just as most people do. The same is the case with tutorials. This is not homework and I have been checking openpyxl for the last one or two months to find what is required by me when I found nothing of what is required by me then posted on this google group. -- https://mail.python.org/mailman/listinfo/python-list
What to write or search on github to get the code for what is written below:
All this is going to be in python’s flask and HTML only 1. First, I have to check in the Excel sheet or table whether the book user has entered is present in the book bank or not. 2. If a book is present and the quantity of the required book is greater than 0 (COPIES_LEFT column in excel file) and if the user wants the book, it will be assigned to the user which he will take from the book bank physically. When COPIES_LEFT will is less than or equal to 0 the message will be “Book finished or not present”. 3. The quantity of the book in the Excel file will be reduced by 1 in the COPIES_LEFT column and the name of the borrower or user will be entered/added in the Excel file table or sheet already made and the column name is BORROWER’S NAME. 4. The borrower’s or user name can be more than one so they will be separated with a comma in the Excel file BORROWER’S NAME column. - All functions mentioned above are to be deployed on the website pythonhow.com so make according to https://pythonhow.com/python-tutorial/flask/web-development-with-python-and-flask/ - Do you know any other websites to deploy a python web application?? - No time to switch from Excel to anywhere else. Please do not make any changes to the Excel file. - Tutorials and repositories of the web for such problems are also required. The same is required for python (flask, Django...) also. -- https://mail.python.org/mailman/listinfo/python-list
AttributeError: 'NoneType' object has no attribute 'get'
How to correct what is written below: Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Dani Brothers\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__ return self.func(*args) File "D:/Python/Book Bank/New folder/PyCharm/Final/Excel.py", line 57, in SaveBook e_pissue.get(), AttributeError: 'NoneType' object has no attribute 'get' Process finished with exit code 0 -- https://mail.python.org/mailman/listinfo/python-list