Categories
Mastering Development

how to take only last transaction to count timediff mysql 5.7

this is the continue question from find out time difference for every user in condition mysql 5.7 this is my fiddle https://dbfiddle.uk/?rdbms=mysql_5.7&fiddle=31b3be9d1e2444eb0b32c262176aa4b4 i have this table CREATE TABLE test ( ID INT, user_id INT, createdAt DATE, status_id INT ); INSERT INTO test VALUES (1, 13, ‘2020-01-01’, 8), (2, 13, ‘2020-01-03’, 8), (3, 13, ‘2020-01-06’, 8), […]

Categories
Android User Help

Smartphones brands with stylus questions carriers misc question

What phone is better the lg stylo 6 or the moto stylus or the galaxy note 8, 9, 10 Is their better phones with styluses Is their more lg stylo brands 5 6 7 8 etc. Are the galaxy notes.good phones What service provider can you get galaxy note phones besides 20 amd 10 9 […]

Categories
Mastering Development

Using function in javascript to get real time value

I want to get the value of a variable as many times as the user clicks a button. I am using the P5.js editor. let button; let upScore =0 ,preScore=0; let run = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; function setup() { createCanvas(200, 200); background(128); button = createButton(‘click me’); button.position(60, 100); […]

Categories
Mastering Development

ggplot cumulative line plot with custom month order

I need to plot the cumulative sum for each month for different fiscal years. Fiscal year start in October and ends in September. total <- c(5, 2, 3, 4, 7, 4, 7, 8, 5, 6, 2, 25, 7 ,8, 0, 6, 4, 4) fiscal_year <- c(19, 19, 19, 19, 19, 19, 19, 19, 19, 19, […]

Categories
Mastering Development

How to Create Variables from OLS Regression Results?

import numpy as np import pandas as pd from scipy import stats import statsmodels.api as sm import matplotlib.pyplot as plt d = {‘City’: [‘Tokyo’,’Tokyo’,’Lisbon’,’Tokyo’,’Madrid’,’Lisbon’,’Madrid’,’London’,’Tokyo’,’London’,’Tokyo’], ‘Card’: [‘Visa’,’Visa’,’Visa’,’Master Card’,’Bitcoin’,’Master Card’,’Bitcoin’,’Visa’,’Master Card’,’Visa’,’Bitcoin’], ‘Client Number’:[1,2,3,4,5,6,7,8,9,10,11], } d = pd.DataFrame(data=d).set_index(‘Client Number’) df = pd.get_dummies(d,prefix=”, prefix_sep=”) X = df[[‘Lisbon’,’London’,’Madrid’,’New York’,’Tokyo’,’Bitcoin’,’Master Card’,’Visa’,’No’,’Yes’]] Y = df[‘Total’] X1 = sm.add_constant(X) reg = sm.OLS(Y, X1).fit() […]

Categories
Mastering Development

when we reshape numpy array, how is the stride size inferred?

I have an 1×1024 1-d array (flattened image). To see the image, I want to reshape its size as 32×32. I can easily achieve this by doing x.reshape(-1,32) and it works as I intended. It doesn’t screw the image. It reads the 1d array with 32-width stride each time. Say this time, there are 4 […]

Categories
Mastering Development

LCD screen display random characters

So I am ultimately trying to build a fun security system using a 4×4 number pad, arduino, and a solenoid. While trying to get the number pad and LCD to work together, I keep running into issues for reasons unknown to me. The code below is what I have so far: #include <LiquidCrystal.h> // includes […]

Categories
Mastering Development

Replace each record with closest in numpy array/pandas dataframe

So, the situation is: I have two numpy 2d arrays/pandas dataframes (doesn’t matter, what I will use).Each of them contains approximately 106 records.Each record is a row with 10 float numbers. I need to replace each row in second array(dataframe) with row from the first table, which has the smallest MSE compared to it. I […]

Categories
Mastering Development

How to add a dataframe to another dataframe created via generator in pandas

I have 2 dataframes: df1 = pd.DataFrame({‘A’:[9, 9, 8]}) df2 = pd.concat([pd.DataFrame([i], columns=[‘A’]) for i in range(5)], ignore_index=True) I would like to add those 2 dataframes together in 1 line via pd.concat I have tried this: df2 = pd.concat([(pd.DataFrame({‘A’:[9, 9, 8]})), (pd.DataFrame([i], columns=[‘A’]) for i in range(5))], ignore_index=True) I am getting the following error message: […]

Categories
Mastering Development

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