How can we extract the data validation dropdown values(not just formulas/references or a single valued formula result) from a given excel sheet using python? Currently openpyxl helps us to get the formulas but not the values directly. It even fails in cases where file contain extensions(extLst) to the OOXML specifications that are not supported.These datavalidation formulas can contain functions like
Tag: python
Find all possible paths in a python graph data structure without using recursive function
I have a serious issue with finding all possible paths in my csv file that looks like this : Source Target Source_repo Target_repo SOURCE1 Target2 repo-1 repo-2 SOURCE5 Target3 repo-5 repo-3 SOURCE8 Target5 repo-8 repo-5 There a large amount of lines in the datasets, more than 5000 lines. I want to generate all possible paths like this in and return
Struggling with python’s import mechanism
I am an experienced java enterprise developer but very new to python enterprise development shop. I am currently, struggling to understand why some imports work while others don’t. Some background: Our dev team recently upgraded python from 3.6 to 3.10.5 and following is our package structure Now, inside the moduleA.py, I am trying to import subpackage2/moduleZ.py like so But, I
How to deactivate a QVideoProbe?
According to the docs “If source is zero, this probe will be deactivated” But calling setSource(0) gives the following exception: Im running my code on raspberry pi 4 with Rpi Os Bullseye 64bit and PySide2 version 5.15.2. Example code: Answer The source object can be cleared like this: In C++, passing zero to a pointer argument means the function will
How can I do a python API request with the body?
if I do a POST request on Postman with my local API server it works: But if I try in python with this syntax it doesn’t work: requests.post(‘http://127.0.0.1:5001/api/v0/add’, data={‘path’: ‘test’}).text it returns: “file argument ‘path’ is requiredn” Can you please explain me why it doesn’t work? Answer The issue is that using data on requests.post defaults to application/x-www-form-urlencoded while your
Why does GPU memory increase when recreating and reassigning a JAX numpy array to the same variable name?
When I recreate and reassign a JAX np array to the same variable name, for some reason the GPU memory nearly doubles the first recreation and then stays stable for subsequent recreations/reassignments. Why does this happen and is this generally expected behavior for JAX arrays? Fully runnable minimal example: https://colab.research.google.com/drive/1piUvyVylRBKm1xb1WsocsSVXJzvn5bdI?usp=sharing. For posterity in case colab goes down: Thank you! Answer
join two rows itertively to create new table in spark with one row for each two rows in new table
Have a table where I want to go in range of two rows How to I create below table that goes in a range of two and shows the first id with the second col b and message in spark. Final table will look like this. Answer In pyspark you can use Window, example Output:
How do I solve a two-sum problem with multiple solutions?
So essentially it is a simple two sum problem but there are multiple solutions. At the end I would like to return all pairs that sum up to the target within a given list and then tally the total number of pairs at the end and return that as well. Currently can only seem to return 1 pair of numbers.
Pandas lagged rolling average on aggregate data with multiple groups and missing dates
I’d like to calculate a lagged rolling average on a complicated time-series dataset. Consider the toy example as follows: This results in the following DataFrame: Now I’d like to add a column representing the average weight per fruit for the previous 7 days: wgt_per_frt_prev_7d. It should be defined as the sum of all the fruit weights divided by the sum
How can I sort 2d array includes only string characters in Python?
There is an array as below; I used the following codes to sort this array by the second column but without success. Is there anyone to help? Answer np.take(x, x[:, 1].astype(int).argsort(), 0) You may just cast the values for sorting. The overall result of you np.take() will remain as strings.