Hello this is using python panda From the above code what I get is From this list I want to actually get the mean of the values inside the class list. For example for ABC I want to get (123+345+678)/3 and for JIK (456+789)/2. I tried getting the mean of the values but I found out inside lists we cannot
Tag: python
Python — Confusing result when combining for loop with while loop
Hi I’m new to programming. I tried to use for loop and a nested while loop to calculate the sum of an arithmetic sequence on condition that the sum is no bigger than 100. I wrote the code below, but the output was 100 instead of the correct sum of the elements of the sequence (which should be 92). Could
DOCX to PDF converter program
I’m making a doc to pdf converter program, and i have occured an error as below: Im an begginer in programming and i dont know how to fix it, below i paste python code: There are two templates called index.html and docx.html in Templates directory, this is how it looks in Pycharm: Does anyone have an id…
collect subprocess outputs and write to excel in python
I wrote a loop in python to cope with a list of tasks, and during every loop certain outputs (plain text) from either stderr or stdout will be generated, what I want is trying to collect them inside python and at the end write them together into excel. I also tried before write them respectively after every l…
Counting consecutive occurrences of a specific value in PySpark
I have a column named info defined as well: I would like to count the consecutive occurrences of 1s and insert 0 otherwise. The final column would be: I tried using the following function, but it didn’t work. Answer From Adding a column counting cumulative pervious repeating values, credits to @blackbis…
Creating A GUI for Editing A Config File Using Python
So, I have a .toml config file and its something like this: I know how to pars the toml file (using it’s module) I want to make a program using python, that let’s other users choose for example the apu mentioned above (between any,nop,sdl,…),meaning the program suggests the options (any,nop,…
Using a class decorator to automatically run a method with a child process
I was asked to develop a consistent way to run(train, make predictions, etc.) any ML model from the command line. I also need to periodically check the DB for requests related to training, like abort requests. To minimize the effect checking the DB has on training, I want to create a separate process for fetc…
KivyMD widgets displaying at the bottom of page in MDBoxLayout
KivyMD widgets are displayed at the bottom when using MDBoxLayout. I remember two MDTextField widgets and one MDRaisedButton, but they are located at the bottom. When using Kivy without KivyMD, there is no such problem. Here is my code: Result: Result of run this code I tried to replace MDBoxLayout to BoxLayo…
Listen for Microsoft.Storage.BlobCreated event using python
I need to monitor Azure Blob Storage and check if a blob is created in Python. In Logic Apps, this is how it looks: Can you help me out and tell me how I should write this in Python? Answer One of the workarounds is to use Azure functions Blob trigger for python where you can able to retrieve the
Python (Sum of expense, income, and profit)
In Python I have a list of entries. I need to get the sum of expenses, the sum of income, and the profit. I’ve been able to get the expenses and income. Looking to break out the profit. I know I’m missing something simple but can’t figure it out. Answer Looks like you just want to calculate …