Categories
Mastering Development

Fast way to remove array of specific row values from 2D numpy array

I have a 2D array like this: a = np.array([[25, 83, 18, 71], [75, 7, 0, 85], [25, 83, 18, 71], [25, 83, 18, 71], [75, 48, 8, 43], [ 7, 47, 96, 94], [ 7, 47, 96, 94], [56, 75, 50, 0], [19, 49, 92, 57], [52, 93, 58, 9]]) and I want to […]

Categories
Mastering Development

Seaborn lineplot and barplot don’t align in the X axis

Okay so I’ve been stuck here for the past 5 hours but I can’t seem to do this combo graph correctly. import pandas as pd from matplotlib import pyplot as plt import seaborn as sns data = pd.read_csv(‘rating_conversion.csv’) df = pd.DataFrame(data) overall_conversion_rate = df[‘overall_conversion_rate’] page_view_conversion = df[‘page_view_conversion’] Avg_Rating = df[‘avg_rating’] Total_Hired = df[‘total_hires’] df[:12] fig, […]

Categories
Ask Chemistry

How would someone in 1917 describe elements 43, 61, 72, 75, 84, 85, 87, 89, and 91?

https://books.google.com/books?id=aaELAAAAYAAJ&printsec=frontcover#v=onepage&q&f=false Notice the list of elements on pages 62–63. It includes a short description of each element’s "Nature under Ordinary Conditions." I am curious to know what the author might have written for elements 43, 61, 72, 75, 84, 85, 87, 89, and 91 (based on 1917 knowledge; for those which hadn’t yet been discovered, […]

Categories
Mastering Development

Creating random integer array without duplicates

I am trying to create a random array without duplicates. The assignment is to take an integer array and maximum value from user, fills the array with random numbers between 0 and maximum value, and display random array without duplicates, WITHOUT using any other classes except random and scanner. This is a sample output: Please […]

Categories
Mastering Development

Object.keys(myObject) returns an arbitrary list of numbers, not expected value

This is a bit of a head-scratcher – and has been a source of pain for the past 3 hours. Here’s my code. const payloadBody = JSON.parse(gatewayEvent.body); console.log(payloadBody); console.log(gatewayEvent.body); console.log(payloadBody.paymentMethodId); console.log(payloadBody[‘paymentMethodId’]); console.log(Object.keys(payloadBody)); If I look at the CloudWatch logs for this (I am executing in Lambda), the line console.log(payloadBody) logs: { "customerId": "cus_REDACTED", "paymentMethodId": "pm_REDACTED", […]

Categories
Mastering Development

Paste a Confidence Interval into cells of a data frame

I have a data frame, with a example one listed below. x <- data.frame("Col1" = 1:10, "Col2" = 11:20, "Col3" = 21:30) v <- c(1,2,3,4,5) #2.5%, 25%, 50%, 75%, 97.5% sample CI. #How do I get x[1,1] to be followed by "(v[1],v[5])" #The result should be 1 (1,5) in the new "x" data frame first […]

Categories
Mastering Development

Trouble with rank or rownum with SQL window function

The output I would like from the data below should look like this: id empid question type rownum 1 75 How old are you SSS 1 2 75 NULL LLL 2 3 88 How old are you SSS 1 4 88 NULL LLL 2 5 99 How old are you SSS 1 6 99 How […]

Categories
Mastering Development

How to split dataset to train, test and valid in Python?

I have a dataset like this my_data= [[(‘Manchester’, ’23’, ’80’, ‘CM’), (‘Manchester’, ’22’, ’79’, ‘RM’), (‘Manchester’, ’19’, ’76’, ‘LB’)], [(‘Benfica’, ’26’, ’77’, ‘CF’), (‘Benfica’, ’22’, ’74’, ‘CDM’), (‘Benfica’, ’17’, ’70’, ‘RB’)], [(‘Dortmund’, ’24’, ’75’, ‘CM’), (‘Dortmund’, ’18’, ’74’, ‘AM’), (‘Dortmund’, ’16’, ’69’, ‘LM’)] ] I know that using train_test_split from sklearn.cross_validation, and I’ve tried with […]

Categories
Mastering Development

R – In sqrt(1 – h * h) : NaNs produced from within rcorr – full sample data available

I have some code that creates a matrix of survey question responses, Rows – answers to the questions from a unique survey instrument, columns the individual questions. A final column has been appended with the row means. This is then passed to rcorr for evaluation. I have 15 sets of data, but only within this […]

Categories
Mastering Development System & Network

Use QLC SSDs as RAIDZ (scientific archive)?

We are building a system for the archival and scientific analysis of some weather data. The setup is redundant, with two HP DL580, Proxmox (ZoL) and some GPUs for analysis. On each server we plan 5 pools of around 50 TB. We use SSDs for density reasons and read speed. We have been working with […]