Categories
Mastering Development

Trying to create a multidimensional array with the calendar module in python

strong text This is the code i am working with currently and that i want to create a multidimensional array of the year 2020 using all the months \idk why this is telling me to add context Blockquote import calendar a = calendar.monthcalendar(2020,1)+ \n + calendar.monthcalendar(2020,2) print(a) """ print(calendar.monthcalendar(2020,2)) print(calendar.monthcalendar(2020,3)) print(calendar.monthcalendar(2020,4)) print(calendar.monthcalendar(2020,5)) print(calendar.monthcalendar(2020,6)) print(calendar.monthcalendar(2020,7)) print(calendar.monthcalendar(2020,8)) […]

Categories
Mastering Development

How to run my trained Artificial Neural Network model?

I have trained my ANN and saved it using Python. Now I want to use it can anybody help me. It is a regression ANN, I have 7 independent variables and one dependent variable which is my output (Compression_Strength). I have new data that I want to use my model to predict my Compression strength. […]

Categories
Mastering Development

How to Un-Sort The legends in the graph in R?

I am not an expert in R. I am having an issue, the legends are sorted alphabetically. I cannot arrange them manually because I have 87 patients and each patient has 300 days and the status (category) changes every day so i want to plot the graph exactly like it has in the source. ggplot(data […]

Categories
Mastering Development

Pandas: dynamically append dataframe column into a running total dataframe within a loop

I am writing a simulation and I am trying to append the result of EACH ITERATION INTO a dataframe that keep track of all the iterations. While everything works fine with collecting the results, I cannot find a way to append the results into a new column each time. I have been banging my head […]

Categories
Mastering Development

cannot arrange numbers into shape (n,n) matrix

I have the following code that generates a fractal image, the problem is how to reconstruct numbers to be a matrix. from PIL import Image from pylab import * from numpy import NaN import numpy as np import matplotlib.pyplot as plt def julia(C): X = arange(-1.5, 1.5, 0.05) Y = arange(-1.5, 1.5, 0.05) pixel = […]

Categories
Mastering Development

Search and process data from multi-index DataFrames

I have two dataframes df2, with the payment statistics (that have the probability of the client pay a certain debt) and df3 with new clients data. import pandas as pd d = {‘City’: [‘Tokyo’,’Tokyo’,’Lisbon’,’Tokyo’,’Tokyo’,’Lisbon’,’Lisbon’,’Lisbon’,’Tokyo’,’Lisbon’,’Tokyo’,’Tokyo’,’Tokyo’,’Lisbon’,’Tokyo’,’Tokyo’,’Lisbon’,’Lisbon’,’Lisbon’,’Tokyo’,’Lisbon’,’Tokyo’], ‘Card’: [‘Visa’,’Visa’,’Master Card’,’Master Card’,’Visa’,’Master Card’,’Visa’,’Visa’,’Master Card’,’Visa’,’Master Card’,’Visa’,’Visa’,’Master Card’,’Master Card’,’Visa’,’Master Card’,’Visa’,’Visa’,’Master Card’,’Visa’,’Master Card’], ‘Colateral’:[‘Yes’,’No’,’Yes’,’No’,’No’,’No’,’No’,’Yes’,’Yes’,’No’,’Yes’,’Yes’,’No’,’Yes’,’No’,’No’,’No’,’Yes’,’Yes’,’No’,’No’,’No’], ‘Client Number’:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22], ‘DebtPaid’:[0.8,0.1,0.5,0.30,0,0.2,0.4,1,0.60,1,0.5,0.2,0,0.3,0,0,0.2,0,0.1,0.70,0.5,0.1]} df = pd.DataFrame(data=d) df2=df.groupby([‘City’,’Card’,’Colateral’])[‘DebtPaid’].\ value_counts(bins=[-0.001,0,0.25,0.5,0.75,1,1.001,2],normalize=True) […]

Categories
Mastering Development

Writing a Python function that finds a Hamiltonian path in a graph

I was trying to write a function that will take a positive integer n as an input and will put the integers 1 through n in an order such that the sum of every adjacent number is a perfect square (if such an order exists). I realized that if I create a graph where vertices […]

Categories
Mastering Development

go to next step only when validation pass

I have a wizard form where I need to check if there is any validation issue on each step so that if there is an issue then don’t allow user to go to next step unless there is no validation error. On this check, I am facing an issue. The issue is, on step 1 […]

Categories
Database Development

Split date range (timestamp) into equal parts by Month- SQL Server Synapse

Experts, Have a question regarding splitting a date range into equal parts by months including the time part example – fromdate – 06/29/2020 09:00:00 and todate – 06/29/2021 09:00:00 Want to split this date range into twelve equal parts like below 06/29/2020 09:00:00 – 06/30/2020 12:59:59 07/01/2020 00:00:00 – 07/31/2020 12:59:59 ……… ……. 06/01/2021 00:00:00 […]

Categories
Mastering Development

how to calculate the scatter within classes for a 50×20 matrix

I am trying to reduce a largely dimentional matrix to only 2D, i was using an example for 2D arrays,which works, but i would need to do the same for a higher dimentional scatter. I have two classes and each classes have matrices of 50×20 dimensional feature spaces. For my example i have these 2D […]