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
Game Creation Mastering Development

Material looks different on programatically generated mesh compared to resized default cube mesh

I’ve written some code that generates a mesh from some 2D nodes, generating both triangles and vertices. It seems to have worked pretty well, since I get a solid mesh without any weird rendering artefacts: As you can already see in the preview, I am experiencing some problems with lighting and materials, despite the triangles […]

Categories
Mastering Development

Fit Variance gamma to data

I am using R studio to estimate paramters for data under Variance Gamma. I want to fit this data to the data and find estimates of parameters. The code I have is x<-c(1291,849,238,140,118,108,87,70,63,58,50,47,21,21,19) library(VarianceGamma) init<-c(0,0.5,0,0.5) vgFit(x, freq = NULL, breaks = NULL, paramStart = init, startMethod = "Nelder-Mead", startValues = "SL", method = "Nelder-Mead", hessian […]

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

How To Combine Cube Code and Camera Code in OPENGL

Hi I’m not sure how to do this and I want your help. I want to know how should I combine the cube code and the camera code so that it can show a cube that has a ground because I want to animate an arm and grab the cube on a table, and move […]

Categories
Mastering Development

Error in guess(varying) when trying to fit an mlogit in R

I am struggling to reproduce a choice modeling mlogit example with willingness to pay. When I try to fit the first mlogit, I get an error that says "Error in guess(varying) : failed to guess time-varying variables from their names In addition: Warning message: In dfidx::dfidx(data = data, dfa$idx, drop.index = dfa$drop.index, : the levels […]

Categories
Mastering Development

tkinter canvas size and navigation toolbar issues

In my Tkinter GUI widget, I want to place my plots in the plot area (plot frame). However, I have a few issues. The plot frame doesn’t cover the whole screen no matter how many columns I add to the widget. I want graphs as big as possible. The graphs don’t start from the top […]

Categories
Mastering Development

How to overlay a netcdf4 raster image on world map?

I am attempting to plot a world map of aerosol height data pulled from the Sentinel 5 Precursor/TROPOMI level 2 data from the data hub available here on dropbox. I am specifically looking at Hawaii (5-30 degree N, 130-180 degree W) and am attempting to plot the aerosol height which is in netcdf4 (.nc) format. […]

Categories
Mastering Development

Make a custom loss function in Keras for Variance calculation in the group

I have been trying to make a custom loss function in Keras for adding extra limits to groups. I have a backbone network with output as the same size as the input image to evaluate a probability(0~1). Here I have group information that has the same size as input and output. The same value in […]

Categories
Linux Mastering Development

How to write grid in csv file in python

I have a list of tuples. Each tuple contain 2 values, together with the results of an operation between the two values. Here is an example: my_list = [(1,1,1.0), (1,2,0.8), (1,3,0.3), (2,1,0.8), (2,2,1.0), (2,3,0.5), (3,1,0.3), (3,2,0.5), (3,3,1.0)] I need to store this value in a csv file so that they look like this: 0 1 […]