I have a root home page made using the default model that comes out of the box with Wagtail. I’m currently trying to create a navbar header that maps out children pages in the following manner: The problem here is, I’m using the wrong tag. Above I use home_page, but that does not seem to work. I a…
Prompt user to choose the name and location when saving a pdf (python)
How can I change my code so I can save my final pdf (MergedFiles.pdf) with a name chosen by the user and in a location chosen by them. I would like to have a popup(maybe tkinter?) that will give the user the option of choosing the name and location to save the pdf file. Answer You can do this with
Why does this Traceback error come up in Python?
I am writing something that merges a PDF (in a Supplement folder) with many PDFs (in an Input folder) then saves them into an Output folder. This seems to work once taking the first PDF in the Input folder, merging it with the PDF in the Supplement folder, and saving it into the Output folder without issue. B…
Pyspark get top two values in column from a group based on ordering
I am trying to get the first two counts that appear in this list, by the earliest log_date they appeared. In this case my expected output is: This is what I have working but there are a few edge cases where count could go down and then back up, shown in the example above. This code returns 2021-07-11 as the
Comparing two sequence columns, and base on a condition add element to Dataframe
Hello, I’m looking for a script in Python that can help me with the following problem: Having the following two columns, I need to create gaps between the sequences in order to make them match: Input Output Index column A column B column A column B 0 1 1 1 1 1 2 2 2 2 2 2 2 2
Getting the coordinates of elements in clusters without a loop in numpy
I have a 2D array, where I label clusters using the ndimage.label() function like this: I can get the element counts, the centroids or the bounding box of the labeled clusters. But I would like to also get the coordinates of each element in clusters. Something like this (the data structure doesn’t have …
Python: Setting the X and Y vectors of a bullet
I need to calculate the vector_x and vector_y of a bullet, fired from x1, y1. The target is at x2, y2. vector_x describes the number of units the bullet travels in the x direction per second. vector_y describes the same, just with the y direction. I tried many different versions of the same function, but I wa…
What is wrong my python code, I’m trying to add implement multiple file search criteria for files
I want to make changes in my code so I can search for multiple input files and type multiple inputs, let’s say if client order number 7896547 exist in the input file I put there. What is the best way to implement multiple search criteria for multiple files. What I meant is giving around let’s say …
Error in implementing autokeras timeseries model
I was trying to implement autokeras TimeSeriesForecaster on a serial dataset. The features and label of the dataset are respectively given below. df1_x = AutoML preparation The dataframe has no NaN values, the shape of the features dataframe is (7111, 8) i.e. a 2D dataframe. But the error came as following: A…
.strip() on array using for loop in Python not working?
I’m trying to get rid of blankspace before and after an element in an array using .strip(), How do i get this to work correctly, I currently have : my output which is nearly right, but still has a space before the second element is: Answer I believe you are stripping before splitting. You want to split …