Categories
Mastering Development

SQL check if group is continuous when ordered and return broken groups

I am trying to find a way to list rows, that are breaking continuous groups of records. I say groups, because we could use GROUP BY to list values of groups (but that is not applied, we need particular rows). Sample data: CREATE TABLE Test (ID INT, NNO INT, DIDX INT, SIDX INT); — Valid […]

Categories
Mastering Development

How to Un-Sort The legends in the graph in R?

I am not an expert in R. I am having an issue, the legends are sorted alphabetically. I cannot arrange them manually because I have 87 patients and each patient has 300 days and the status (category) changes every day so i want to plot the graph exactly like it has in the source. ggplot(data […]

Categories
Mastering Development

Why D3 adds element outside of the body

I am trying to add elements inside svg using the D3 data enter then append function. D3 adds circles outside of the body. I am unable to figure out how to bring circles inside svg. Sample HTML: <html> <script src=’https://d3js.org/d3.v5.min.js’></script> <body> <svg width=500 height=500></svg> </body> <script> var data = [4,8,15,16,23,42]; var svgContainer = d3.select(‘body’).selectAll(‘svg’); svgContainer.data(data).enter().append("circle"); […]

Categories
Linux Mastering Development Ubuntu

Network icon is not displayed in tray, and no WiFi networks displayed

I am running Ubuntu 18.04.4 XXXXXXXXXXXXXXXXXXXXX:~$ lsb_release -a LSB Version: core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic I read another question, "Ubuntu 18.04 WiFi Networks are not displaying even though there are 3 nearby", on AskUbuntu and tried the solution there. It did not work. I still have no visible […]

Categories
Mastering Development

How to remove outliers from multiple columns in pyspark using mean and standard deviation

I have the below data frame and I want to remove outliers from defined columns. In the below example price and income. Outliers should be removed for each group of data. In this example its ‘cd’ and ‘segment’ columns. Outliers should be removed based 5 standard deviations. data = [ (‘a’, ‘1’,20,10), (‘a’, ‘1’,30,16), (‘a’, […]

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

Scraping text injected by Javascript using BeautifulSoup

I want to scrape the date from a webpage, and the text of the date (after script tag) is injected by JavaScript: I want to scrape it using Beautifulsoup only, not selenium <div class="row"> <span class="LName"><a target="_blank" href="http://google.com">[me too]</a></span> <script language="Javascript" type="text/javascript">formatDate(‘2020,5,23,09,00,00’,1)</script>6/23/2020&nbsp;10:00&nbsp;Tuesday </div> this is the code used to try scraping the date text: headers […]

Categories
Database Development

How to use aggregate functions on each array in a table, in Postgres?

Imagine I have a table like: games ( scores INTEGER[] ) And it had values {1,2} {3,4} {} I’d like to do arbitrary aggregations on that array. For example, how would I do SELECT SUM(scores) AS total FROM games? Or an average? Or a max? I’d like to get out: 3 7 0 I tried […]

Categories
Mastering Development

Crossing categorical features that are stored as integers

I’m experimenting with the following dataset: https://archive.ics.uci.edu/ml/datasets/Teaching+Assistant+Evaluation Data Set Information: The data consist of evaluations of teaching performance over three regular semesters and two summer semesters of 151 teaching assistant (TA) assignments at the Statistics Department of the University of Wisconsin-Madison. The scores were divided into 3 roughly equal-sized categories ("low", "medium", and "high") to […]

Categories
Database Development

Primary Key and Unique Constraints in Partitioned Table

I am currently creating a project that applies to a table that contains about 40 columns (including varchar (max)) and will be partitioned. About 200-250 records per second will be inserted into the table, which gives a daily volume of around 21 600 000 records. The last 14 days should be kept in the table, […]