I’m trying to make the generation of charts a little bit more dynamic so other users can get a bit more value out of my code. Currently, I do this (and variations of it) to produce a variety of charts: And this works perfectly well, but involves people scrolling through the code to individually change t…
Tag: python
Getting Rolling Sum per Group
I have a dataframe like this: I would like to get the Sum of the last three months (excluding the current month), per Product_ID. Therefore I tried this: My code is failing, because it does not only calculate it per product, but it will give me also numbers for other products (let’s say Product 2, quart…
Visualize each row of pandas data frame as a tree
I have a data frame having 4 columns A, B, C, D. I need to visualize/ print each row of my data frame as a tree structure. Example: df[‘A’] = franchisee df[‘B’] = sign off df[‘C’] = status df[‘D’] = registration Then, I need to visualize this row as a tree where…
entry_point file using XGBoost as a framework in sagemaker
Looking at the following source code taken from here (SDK v2): I wonder where the your_xgboost_abalone_script.py file has to be placed please? So far I used XGBoost as a built-in algorithm from my local machine with similar code (i.e. I span up a training job remotely). Thanks! PS: Looking at this, and source…
How can I perform search operation using raw sql query in django SQLITE
I’m trying to search string in the STAT table’s detection field like below: Here, when I give the word or some character which are contained in detection_class, it returns an error message like thisTypeError(‘not all arguments converted during string formatting’)),. and also if I try l…
xticks and yticks issues while using imshow
I’ve a problem with fixing the xticks and yticks for the imshow plot. When I use the single plot for imshow then the extent works better (see first figure below). However, when I use to insert the coordinates of the local maxima on the imshow plot then the ticks have changed (second figure). Can anybody…
Tensorflow: Issues with determining batch size in custom loss function during model fitting (batch size of “None”)
I’m trying to create a custom loss function, in which I have to slice the tensors multiple times. One example is listed below: This (and the entire loss function) works fine when testing it manually on selfmade Tensors y_true and y_pred, but when using it inside a loss function it will give an error upo…
Why there is space and p in last line in output?
this is the output Why there is space and p in last line in output ???? Answer It is because your string contains a space and n is treated as a line break, leaving a p at the end of each line.
How to sort a python list of arbitrary strings like Excel Column Names?
E.g. I have: then I need to get: Answer If the column identifier is guaranteed to be the second whitespace delimited token in each string then: The conv() function takes the column identifiers and converts them into a value that can be used for natural sorting Output:
XLWINGS conditional formatting based on value
I have a dataframe in Pandas that I have exported to Excel and formatted headers etc. using XLWINGS. That works like a charm. But I would like to format two columns based on their value in each cell (row), so if the value is above 0 then green and below zero then red. I can’t seem to find that option