Categories
Mastering Development

python seaborn: customize line plot and scatterplot together (also legend)

df = pd.DataFrame({ ‘id’: {0: -3, 1: 2, 2: -3, 3: 1}, ‘val’: {0: 0.4, 1: 0.03, 2: 0.88, 3: 1.3}, ‘indicator’: {0: ‘A’, 1: ‘A’, 2: ‘B’, 3: ‘B’}, ‘count’: {0: 40000, 1: 5779, 2: 3000, 3: 31090} }) df and I hope to get a plot like the following: I know with code […]

Categories
Mastering Development

Make a new variable, var3, by taking the count of all values of var1 and dividing by unique values of var1, over unique values of var2

I’m trying to plot the average number of clicks on a given day over a one week period. The data i’m working with can be found here if you want to take a look. But briefly, it is structured as so: <class ‘pandas.core.frame.DataFrame’> RangeIndex: 400165 entries, 0 to 400164 Data columns (total 9 columns): uuid […]

Categories
Mastering Development

Insert values between other values in numpy array

Let’s say I start with this array: start_array = [[1.48, 1.79, 2.10, 2.80] [63, 60, 57, 60]] I want to take the values in this second array: second_array = np.array([2.3,3.42, 4.47]) and insert them in in between the values in the first row, with a 1 in another row to code that something occurred there. […]

Categories
Ask Games RPG Games

How to calculate probability of values under Weibull distribution?

I have a Genomic data that shows the interaction between genomic regions that I would like to understand which interactions are significant statistically. Dataset look likes: chr start1 end1 start2 end2 normalized count 1 500 1000 2000 3000 1.5 1 500 1000 4500 5000 3.2 1 2500 3500 1000 2000 4 So, I selected a […]

Categories
Mastering Development

numpy combine arrays with index ordering

I would like to combine multiple numpy arrays by the order of the index. Here is what I mean: Suppose I have two numpy arrays like >>> a = [0, 1, 2, 3] >>> b = [-5, -6, -7, -8] How can I combine these arrays such that the output is c = np.combination_function((a,b)) >>> […]

Categories
Mastering Development

How to more accurately approximate a set of points?

I would like to approximate bond yields in python. But the question arose which curve describes this better? import numpy as np import matplotlib.pyplot as plt x = [0.02, 0.22, 0.29, 0.38, 0.52, 0.55, 0.67, 0.68, 0.74, 0.83, 1.05, 1.06, 1.19, 1.26, 1.32, 1.37, 1.38, 1.46, 1.51, 1.61, 1.62, 1.66, 1.87, 1.93, 2.01, 2.09, 2.24, […]

Categories
User Help Web Apps

How to open sheets to a specific tab based on days of the week?

I have a file with 7 tabs or sheets each of them represent a day of the week (Monday to Sunday). In each day (Tab) a have this formula in B2 to show the day of the week if it is today… =IF(WEEKDAY(TODAY(),2) = 1, "Monday", IF(FALSE, "True", )) =IF(WEEKDAY(TODAY(),2) = 2, "Tuesday", IF(FALSE, "True", […]

Categories
Mastering Development

print array as a matrix by having all elements in the right columns

I am trying to print my dataframe as a matrix. To do so, I want to use an array. To be clear: I have a dictionary, Y, which is like this: {(0, 0): {(0, 0): 0, (1, 0): 1, (0, 1): 1, (0, 2): 2, (0, 3): 3, (1, 3): 4, (0, 4): 10, (1, […]

Categories
Mastering Development

How can I make a PlotDataItem with unique IDs per distinct line segment?

I also posted in the pyqtgraph forum here. My overall goal is to have several clickable regions overlaid on an image, and if the plot boundary of any region is clicked I get a signal with the ID of that region. Something like this: If I use only one PlotDataItem with nan-separated curves then each […]

Categories
Artificial Intelligence (AI) Mastering Development

What is correct update when the some index’s are not available?

To update the Q table q learning takes the arg max of the q values – the state, value mappings. For example, in tic tac toe the state XOX OXO -X- contains two available positions, each marked by the – character. In order to evaluate the arg max should temporal difference calculate the arg max […]