Categories
Mastering Development

Creating custom/more distance of ticks x axis in ggplot R

Please find my code below: packages <- c("ggplot2", "dplyr", "quantreg", "officer","tidyverse","here","glue","rvg","viridis","scales") install.packages(setdiff(packages, rownames(installed.packages()))) lapply(packages, require, character.only = TRUE) data <- read.csv(file=’Spiderplot_data.csv’, header=TRUE) Progressed <- as.factor(data$Progression) Response <- as.factor(data$X) Response <- factor(data$X, levels = c("Progressive Disease", "Stable Disease", "Partial Response", "Complete Response")) highlight_df <- filter(data, Progression == 1) p <- ggplot() + geom_line( data, mapping = […]

Categories
Mastering Development

Py-Game Connect4 – Minimax (Program Halting Recursively)

main.py from Player import Player import tkinter as tk import pygame import pygame_menu import time import colors import Connect4 as cFour import Minimax as mx def text_format(option, textSize, textColor): """ Creates a text object to show in the main menu """ newFont = pygame.font.Font(pygame_menu.font.FONT_FRANCHISE, textSize) newText = newFont.render(option, 0, textColor) return newText def load_screen(): """ […]

Categories
Mastering Development

indexing rows and columns in numpy

a = np.array(list(range(16).reshape((4,4)) array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]]) Say I want the middle square. It’d seem reasonable to do this: a[[1,2],[1,2]] but I get this: array([5, 10]) This works, but seems inelegant: a[[1,2],:][:,[1,2]] array([[5, 6], [9, 10]]) So my questions are: […]

Categories
Mastering Development

What is required to make this treemap plot work?

Been trying to get treemap to work but the output is blank and not sure why. If I take an example from the web and place it into my code the the output works fine – but when I try to use my data it does not output. The sample code is.. library(plotly) labels = […]

Categories
Mastering Development

How to convert multidimensional Arraylist to single Arraylist in Java?

[[4, 17, 28, 38, 43, 58, 69, 77, 83], [4, 12, 24, 35, 48, 55, 62, 73, 87], [11, 15, 22, 36, 46, 60, 67, 80, 84]] (which is Arraylist<Arraylist>) how to convert that to this: [4, 17, 28, 38, 43, 58, 69, 77, 83, 4, 12, 24, 35, 48, 55, 62, 73, 87, 11, […]

Categories
Mastering Development

How to get key from the value of dictionary

I have the following set of rules for grading system if 25 < score <= 30, grade = A. if 20 < score <= 25, grade = B. if 15 < score <= 20, grade = C. if 10 < score <= 15, grade = D. if 5 < score <= 10, grade = E. […]

Categories
Mastering Development

While unstacking, getting error ‘ValueError: Index contains duplicate entries, cannot reshape’

I have a dataframe on which I need to apply condition based on same values of rows in few columns and update other columns. Input Dataframe initialization: df = pd.DataFrame({ ‘exp’:[‘1y’,’1y’,’1y’,’1y’,’1y’,’1y’,’1y’,’1y’,’1y’,], ‘mat’:[‘1y’,’1y’,’1y’,’2y’,’2y’,’2y’,’1y’,’1y’,’1y’,], ‘reg’:[‘in’, ‘in’, ‘in’, ‘in’, ‘in’, ‘in’,’in’,’in’,’in’], ‘con’:[‘5w’,’5s’,’5c’,’5w’,’5s’,’5c’,’10w’,’10s’,’10c’], ‘pcon’:[‘w’,’s’,’c’,’w’,’s’,’c’,’w’,’s’,’c’], ‘val’:[2.5,0,-2.5,2.5,0,-2.5,5,0,-5], ‘rs’:[6, 10, 4, 12, 30, 6,30,25,10] }) df Input DataFrame: exp mat reg con […]

Categories
Mastering Development

Hangman game input user word to the game Tkinter

I’m currently working on a Hangman game in python with tkinter. My code is working and now I would like to improve it. My current game is choosing a random word from a list. But I would like to change that so in the start menu the player can choose the word. I’ve tried to […]

Categories
Mastering Development

How do I block certain websites which have XYZ in their URL?

I wanted to write some code which limits the usage of some websites such as Instagram completely blocks porn sites by blocking every site with words such as "porn" or "xxx" in the URL switches the computer off automatically at some times It all works out, except for the blocking websites part. I tried to […]

Categories
Mastering Development

Discogs API PHP, Cover image. Curl?

Im looking for something like cURL to get cover image from Discogs API. https://api.discogs.com/database/search?q=Rose%20Laurens%20-%20Quand%20Tu%20Pars%20(12“%20Version)&key=XXXXXX&secret=XXXXXXX I have this output: {"pagination": {"page": 1, "pages": 1, "per_page": 50, "items": 5, "urls": {}}, "results": [{"country": "Germany", "year": "1986", "format": ["Vinyl", "12\"", "45 RPM"], "label": ["WEA", "WEA Musik GmbH", "WEA Filipacchi Music"], "type": "release", "genre": ["Electronic", "Pop"], "style": ["Disco", "Synth-pop"], […]