the problem is here: https://binarysearch.com/problems/Unix-Path-Resolution Given a Unix path, represented as a list of strings, return its resolved version. In Unix, “..” means to go to the previous directory and “.” means to stay on the current directory. By resolving, we mean to eva…
Tag: python
How can I make Matplotlib show all tick labels?
I am trying to plot some time series’ and I struggle with the tick labels. my df looks like this: The code to plot it looks like this: The plot however looks like this https://i.stack.imgur.com/tKqP6.png How can I make it thath it shows all years as x ticks? Thank you in advance Answer Try this: The out…
AttributeError: ‘int’ object has no attribute item
The code is: Why does it happen? I’ve been wasting hours searching for an solution, no result. The error occurs at: Answer Are you thinking something like this? Or if you want to use CreateNew as a class method you can call without creating a new object, you can do it like this But using class methods (…
Extract subtring using regex python
Hello I have this string and I need extract from this some sub strings according some delimiters: And I need extract exactly this strings: I have tried a lot of types: re.findall, re.search, re.match. But I never geted the result expected. For eg: this code bellow print all string: Answer You do not need a re…
Get the value corresponding to the start of a given category created with datetime64[ns]
I have a DataFrame that is a time series every minutes (duration: up to today) All ts are in datetime64[ns] Input: I create a new column with categorical data consisting of periods of 40 days like below: ( I am using pd.cut) , output is: The set of period is as below: [(2021-12-31 23:59:59.999999999, 2022-02-…
How do I center an object on the canvas in Tkinter?
I want to center a circle on the canvas in Tkinter, but I want to combine whatever code does that with mine, without changing it up too much. My program: Is that possible with what I am using currently? Answer You can just draw your circle in the middle of the canvas like this:
Subplots won’t display together + griddata() returning “nan” values
I have a 9×9 matrix in which I know 8 values, at the positions contained in array points, with corresponding values in array values. I want to interpolate the unknown values and paste the result on a 200×200 image. I’m a beginner at python and I’m struggling with the following: My subplo…
How to make list numbers by formula
hey everyone i have a question how i make a formula that makes my numbers in list specific first i need it to start whith number 4 then if if its higher than 6 it needs to restart from 0 it would look like this 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4
Python , Convolution
I want to take the part of mat (matrix) after every three slides. The code I have is taking the part of matrix after one slide. I want to take the first 3 by 3 part of the matrix and then slide 3 columns to the right and take 3 by 3 part and so on, going through all the
Evaluate model on Testing Set after each epoch of training
I’m training a tensorflow model on image dataset for a classification task, we usually provide the training set and validation set to the model.fit method, we can later output model convergence graph of training and validation. I want to do the same with the testing set, in other words, I want to get th…