Categories
Linux Mastering Development

Can you explain this sed expression?

I was doing research on how to generate all non-repeating permutations of a set of a numbers without using recursion in Bash and I found this answer that worked, but I want to understand why. Say you have three numbers: 1, 2, 3. The following command will generate all possible non-repeating permutations: printf "%s\n" {1,2,3}{1,2,3}{1,2,3} […]

Categories
Mastering Development

Year isn’t printing as expected, not sure what I am missing here

I am working on a program that a user enters a date and then the program adds 7 days and prints out the date entered and then prints out the date with seven days added. I am getting the month and date correctly formatted and it appears that it is adding the seven days. However, […]

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

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

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 […]

Categories
Mastering Development

given a list in python, add a number to each entry

UPDATE close to the answer here: l = [‘idXchgTradeID’, ‘quantity’, ‘price’, ‘commission’, ‘commasset’, ‘xchgTradeID’, ‘status’] output = ” for index,s in enumerate(l): output = output + ( s + ‘ = :’ + str(index+1) + ‘, ‘) print(output) As I get the following output: idXchgTradeID = :1, quantity = :2, price = :3, commission = […]

Categories
Mastering Development

Caught in an endless loop with my C program

In my C program, I have a function (datecheck), to check for valid date entries, but I’m caught in an endless loop. What can I put in there to get out? I’ve tried return and break commands in "if loops", but they haven’t worked. It is using struct datee get_date and struct datee, and month. […]

Categories
Mastering Development

How to Call DB2 Table Valued Function from EF Core

I am using ASP.NET core 3.1 with EF Core with DB2 AS400 database. I have created a table value function which looks like this CREATE FUNCTION ABELIBLE.TVFBOEGETSHIPMENTS ( STARTDATE DATE , ENDDATE DATE , ADDRESSCODE CHAR(9) ) RETURNS TABLE ( "ID" INTEGER , JOBNUMBER CHAR(9) , CUSTOMERREFERENCE CHAR(18) , CONSIGNEENAME CHAR(30) , CREATEDDATE DATE , […]

Categories
Mastering Development

Crossing categorical features that are stored as integers

I’m experimenting with the following dataset: https://archive.ics.uci.edu/ml/datasets/Teaching+Assistant+Evaluation Data Set Information: The data consist of evaluations of teaching performance over three regular semesters and two summer semesters of 151 teaching assistant (TA) assignments at the Statistics Department of the University of Wisconsin-Madison. The scores were divided into 3 roughly equal-sized categories ("low", "medium", and "high") to […]