Categories

## Add elements of array to each column of matrix using numpy

I have a matrix 3×3 and array with 3 values and I want to add each value of my array to each column of the matrix, so for example, if I have matrix like: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] and array [1, 2, 3] I want to get a result like […]

Categories

## Merge 2 SQL Server queries

We have to run every week a SQL Server query taking into accounts transactions starting from the latest Saturday at 00:01 until Saturday at 23:59 (Kuwait Time). The process takes into account thousands of rows and is there fore very heavy. I decided to do it in two steps, mostly because i could not manage […]

Categories

## obtain the sum of all the elements in two lists in python

I have two lists a=[1,2,3,4] b=[5,6,7] what i want is to find the sum of each element in both the lists and store the sum to another variable i.e 1+2+3+4+5+6+7=28 and store it to any variable MY CODE for i in range(0,len(od)): s=s+od[i] v=s for i in range(0,len(ed)): v=v+ed[i] print(v) I have found the sum […]

Categories

## how to bond coordinate points after changing values by using a loop in matplotlib

ı need to change coordinate values and ı need to bond them import numpy as np from matplotlib import pyplot as plt import pandas as pd data = np.array([ [0, 2], [0, 3], [0, 6], [0, 7], [7, 9], [7, 8], ]) list =data.tolist() x, y = data.T for x,y in list: x+=1 plt.scatter(x,y,color=’red’,) ı […]

Categories

## print count variable from another class

I created a RandomSumGame in Java and need to provide a count of the amount of wins and losses. I tried to add the print out of the count within the method but it printed it out after each game instead of one total at the end. I moved the print to the main class […]

Categories

## how to predict the output value using logistic regression?

I simulated successfully my classification function to predict the single value of output binary by ANN utilizing pandas and sklearn libraries. Now I want to simulate my model to predict another feature which is not binary, as the input columns are (0,1,4,6,7,8,11,12,13,14) and the output column is (15) of my data set. A typical example […]

Categories

## Creating and adding row for each loop

Doing my first class in python so don’t judge the code ;P My problem is that I want to create a new row for each loop in my list: analyserad_data = [] for i in range(2,6,1): analyserad_data.append(mean_value(([int(row[i]) for row in trafik_data]))) analyserad_data.append(max_value(([int(row[i]) for row in trafik_data]))) analyserad_data.append(min_value(([int(row[i]) for row in trafik_data]))) print(analyserad_data) Gives: [11645.96, 17931, […]

Categories

## PyMC3 – coal mining disaster example – questions re: adding a second mine

I’m playing around with PyMC3, trying to fit a modified version of the mining disaster switchpoint model in the PyMC3 documentation. Suppose you had two coal-mines (mine1 and mine2), each with similar disaster counts for the same range of years. However, mine1 was 5 years late in implementing the change in safety procedures that lowered […]

Categories

## Long query (datediff, subquery, distinct and max)

Im with this problem since 2 days, and I’ve tried everything that come to my mind Sorry my english in advance. In short: MYSQL – I need to bring company that have been inactive for a while (or 365 days for the fiddle example). How I check this? each company have at least a contact, […]

Categories

## What delimiter can be used for .csv that has “,” in it’s column

I want to read .csv file and write to other .csv file. I use streamwriter and use string.split with delimiter (‘,’). using (StreamWriter file = new StreamWriter(destFile, true)) { string lines = System.IO.File.ReadAllLines(inputFile); foreach (string line in lines) { if (line != lines) { string[] values = line.Split(‘,’); file.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", values, values, values, values, values, values, […]