Skip to content

Tag: python

Is there a more efficient way to format this list

I have a list of coordinates, but I want to format them so they form a grid. Right now, for every element of the list, I’m checking what its value is and then formatting it. Is there a smarter, more efficient way to do this? Answer You can replace if-else with the list of min, max and expected values:

Separate columns of a DataFrame by days of the week

Let it be the following Python Panda Dataframe (the original could include dates for several months): Hours 2022-06-06 2022-06-07 2022-06-08 2022-06-09 2022-06-10 2022-06-11 2022-06-12 2022-06-13 2022-06-14 2022-06-15 2022-06-16 2022-06-17 2022-06-18 2022-06-19 00:00 3 0 0 3 23 43 1 2 3 3 7 3 1 0 05:00 5 4 0 …

The regx in pygrep always returns True

I’m using the pygrep in pre-commit and here is my settings: I want to check the commit message format but no mater what I entered, it always returns true. Answer you also commented on github! pick one in the future not both! your regex doesn’t follow the pattern I outlined in that issue you commen…