Categories
Development

Two-Way Repeated Measures ANOVA: Error in lm.fit()… 0 non-na cases (rstatix)

I am trying to run a Two-Way Repeated Measures ANOVA using the R Statix package based on the description from here however I am running into the subject error with my dataset. The data consist of 10 replicate biomass measurements recorded at each of 8 Locations across 5 months (10 reps x 8 locations x […]

Categories
Development

How to cycle through permutations of a list of 88 elements?

I’m trying to assign a single variable each permutation of a list of 88 elements one after another. This means the variable would be re-assigned a new permutation 88! times. I have tried making 88 nested for-loops but apparently there is a limit to how many for-loops you can nest. I am using Python. elements […]

Categories
Development

How to minimize the sum of the elements in the final array after performing k number of operation

This question is asked in my interview coding and there were 12 test cases and i am only able to pass 8 of them. minSum(List values, int k) method need to complete. Example : nums = [10,20,7] and k=4 ans answer for this array is 5+5+4=14. Each operation consists of removing element from the array, […]

Categories
Development

Scrape imdb votes and gross using python and Beautifulsoup

I’ve been trying to work with BeautifulSoup to scrape an imdb webpage (https://www.imdb.com/search/title/?release_date=2017&sort=num_votes,desc&page=1). I’ve successfully scraped the name, year, intro, votes, director, etc. but having difficulties scraping “gross” and “actors”. <p class=”sort-num_votes-visible”> <span class=”text-muted”>Votes:</span> <span name=”nv” data-value=”591671″>591,671</span> <span class=”ghost”>|</span> <span class=”text-muted”>Gross:</span> <span name=”nv” data-value=”226,277,068″>$226.28M</span> </p> <p class=””> Director: <a href=”/name/nm0003506/?ref_=adv_li_dr_0″>James Mangold</a> <span class=”ghost”>|</span> Stars: <a […]

Categories
Development

Deserialize partial JSON

I’m trying to deserialize some partial JSON received from an old SignalR service. This is an example of the original JSON: { “opt”: { “data”: { “DR”: [{ “O”: [ null, “18:46.401”, “RGGW.GWWWR”, “4.1”, 19, “17.852”, “42.455”, “”, null, “+3.893”, “277”, “306”, “”, “310”, “+0.058”, null ], “OC”: [ “1” ] }, { “O”: [ […]

Categories
Development

specific constraint, instead of a general constraint for a least square problem

Let’s say that I have a simple problem like this at hand. import cvxpy as cp import numpy as np A = np.array([[ 143, -144, -343, 56] ,[-7632, 77, -277, 63 ] ,[ 55, -75, 74, 744 ] ,[-22 , 177, -28, 12] ,[-848 , -433 , 121, 54] ,[98, 75, 155, 87]]) b = […]

Categories
Development Python

Parsing a .pdb file in Python and creating a dictionary for specific record types

First, let me start by saying that I’m doing this as a Python exercise and I’m not allowed to use Biopython. I am writing a script that will help me parse any .pdb file generated from a trajectory. I am trying to create a dictionary that would link the chain variable with the resNumber variable. […]

Categories
Development

How to get extremes from already determined groups of peak/valley indexes? [python]

I’m sorry if i’m butchering the question but essentially i have 3 arrays. One array which is the signal data, and an array of peak indexes and an array of valley indexes. The problem however is that sometimes there will be multiple indexes for a peak in a row before there is a valley index. […]

Categories
Development

Combine blocks of different images and produce a new image

I have six photographs. I changed them into block structure. Consider an image of size 200×200. 1. I converted into blocks of 10×10 so now I have 400 blocks in total each of size 10×10. I did this for each image. 2. Then I found the mean value for each block. Again for all images. […]

Categories
Development MySQL

How to improve MySQL stored procedure run for 20 seconds

I have a stored procedure which will run for 20 seconds and make high cpu usage, I found it in the slow query log, this stored procedure always exist and will run for 15 to 30 seconds. I believe this stored procedure caused the high CPU usage. So I am trying to use explain to […]