Skip to content

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…

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