I am trying to solve a routing problem as follows: We have many ‘tasks’ and each task contains many items to be collected by workers items can appear in multiple tasks (e.g. item 1 can be in both task A and B) We already have the distance matrix of the items depot is fixed in each trip, each worke…
Django add custom permission
I am facing the problem of adding custom permission in Django. My idea is that when authorizing a user, if it belongs to group1, only the rows of group1 are displayed, and otherwise the rows of group2. There is a group field in the database table, it contains only two values group1 and group2. In the admin pa…
Using highlight_max and highlight_min from pandas.io.formats.style.Styler at the same time
I want to highlight the maximum value in each row as green and the minimum value as red. But combining those 2 code like this : give me this error What is the correct way to use both of them? Thanks Answer And it turns out that I don’t need to call another style attribute. Will leave this for future
How do I listen for new chat messages in text channels using a discord bot in python?
I’ve designed a system to loop through all the channels and check to see if the last few messages are the same as they were at the previous check, but that’s slow and unnecessary. If there’s any way to do it through a function, or a simpler, faster way, let me know. Thanks! Answer You can us…
django custom Func for specific SQL function
I’m currently performing a raw query in my database because i use the MySQL function instr. I would like to translate is into a django Func class.I’ve spend several days reading the docs, Django custom for complex Func (sql function) and Annotate SQL Function to Django ORM Queryset `FUNC` / `AGGRE…
Is it possible to read a csv file that is located in the python project?
I have a python project with a handful of python scripts, a domain and repository folder with additional python scripts in each etc…. I’d like to create a config folder within this python project that will contain a csv file for configurations that my python project will use. I then would like to …
Importing count() data for use within bokeh
I am trying to create a visualisation using the bokeh package which I have imported into the Databricks environment. I have transformed the data from a raw data frame into something resembling the following (albeit much larger): From there, I wish to create a line graph using the bokeh package to show the num…
loop over series of dictionaries to convert to DataFrames
I have that list of dictionaries in several rows that I need to loop over to create new DataFrame. I have tried the following loop: but getting the following error: unsupported operand type(s) for +: ‘int’ and ‘str’ The type of my s: pandas.core.series.Series Convert string-encoded lis…
Reference local .csv file in altair chart
I’m trying to use altair to visualize data, but I struggle to use it in the way I would like to use it: by not embedding the data inside the generated .html chart, but by referencing the local .csv file that contains the data. Otherwise, it would result in duplicating the data and therefore doubling the…
How can I plot signal statistics(variance) of subintervals in the same graph with signal plot?
I calculated the variance for subintervals in my signal. The result is a vector that I would like to plot in the same graph as the signal below. How can I plot the variance for each subinterval? What type of plot should I use? Histogram or boxplot? Answer If you want to overlay the time series with the bar pl…