Comment by Florian on What's the proper denomination for NA in pyspark...
I personally would use NaN for numeric columns and a string not applicable for string columns, and use None when the data is actually missing so you are able to distinguish between those. But that is...
View ArticleComment by Florian on How to use uploaded file for saving onto local server...
Hi @mikey, what function would you only want to run after an actionButton is clicked? Also, the answer to your question will probably be a bit too elaborate for the comments, so please consider opening...
View ArticleComment by Florian on How to create a countdown timer in Shiny?
@Jamie That depends on the computational complexity of the function. If it's something as simple as this, I do not expect it to be a problem. However, over a longer period of time, the timer might...
View ArticleComment by Florian on Finding non-numeric data in a data frame or vector
Thanbks @Ashish and Ben. I think checking for decimals and negative numbers is a good idea, however the resulting regex Ben proposed will also match invalid elements. So the answer now includes a regex...
View ArticleComment by Florian on Delete unused packages from requirements file
I recently released deptry, a command line utility that checks for various issues with a project's dependencies, such as obsolete, missing or transitive dependencies. It supports requirement.txt files...
View ArticleComment by Florian on Delete unused packages from requirements file
Thanks @pranavcode for the feedback. For now, you can ignore those by running deptry as deptry . -io util,views, or adding configuration to pyproject.toml. Could you elaborate why they are false...
View ArticleComment by Florian on Python code checker for modules included in...
@Brian I recently tried to develop a tool that identifies unused packages, which is also able to deal with the differences in PyPi package names and the imported module names; see my answer here if you...
View ArticleComment by Florian on Nodepool in AKS not scaling down to 0 nodes?
Thanks, that is a good suggestion to give a try! However, apparently that is not allowed on nodepools where the autoscaler is enabled: Cannot scale cluster autoscaler enabled node pool.
View ArticleComment by Florian on Nodepool in AKS not scaling down to 0 nodes?
Thanks for your answer! I am not sure I understand it 100% though. In Azure, the default nodepool is a system nodepool by default. See here. Is this what you refer to a a "dedicated system node pool"?...
View ArticleComment by Florian on Nodepool in AKS not scaling down to 0 nodes?
Thanks for your reply! I see that this could work to scale down the node pool manually occasionally, but in my scenario I want the node pool to scale down to 0 automatically regularly.
View ArticleComment by Florian on deptry reports dependencies as unused, although I need...
I think this actually seems to be an issue with dogpile-cache and not with deptry. When you install a package with an extras option, that should install the base package plus the additional...
View ArticleAnswer by Florian for Problem using 'window' function to group by day in PySpark
I believe you do not need to use a Window to achieve what you want. You would need this for example if you want to have some aggregation of the days before each given date. In your example, you could...
View ArticleAnswer by Florian for SQL/PySpark: Create a new column consisting of a number...
Here is one possible solution, I added some sample data. It indeed uses a window function, as you suggested yourself. Hope this helps!import pyspark.sql.functions as Ffrom pyspark.sql.window import...
View ArticleAnswer by Florian for How to use grepl in every row?
With your new sample data, you could do:pat <- c("mary", "john", "anthony") text <- c("This is a long text about anthony", "This is another long text about john", "This is a final text about...
View ArticleAnswer by Florian for Updating the choices in pickerInput 2 based on the...
You can use uiOutput and renderUI to dynamically generate the required input object. A working example is given below, hope this helps.library(shiny)library(shinyWidgets)managers <- c('Ram',...
View ArticleAnswer by Florian for Insert Pyspark Python k-means model prediction into DF...
You could use map to get the first entry of your rdd with the features, and then use zip to add the predicted clusters. You can convert the resulting rdd with createDataFrame. An example is shown...
View ArticleDifference in environment when using 'docker build' or 'docker run'
I am starting to learn Docker, and I ran into some behavior I could not understand.I want to use conda inside my Docker container, but when using docker build . I ran into the error /bin/sh: 1: conda:...
View ArticleAnswer by Florian for How to change label color of textInput in Shiny Dashboard
In the case of the dateInput, the id is given to a div that wraps both the label and the input itself. In the case of the textInput however, the id is only passed to the input itself, and not to a div...
View ArticleAnswer by Florian for Show modal onclick plotly bar plot
You can use an observer and the event_data from your scatterchart to accomplish that. Working example below, hope this helps!library(shiny)library(plotly)df1 <- data.frame(x = 1:10, y = 1:10)df2...
View ArticleAnswer by Florian for Fit 2 Graphs Side By Side in Shiny Navbar Page Without...
You can get the desired behavior by placing both columns in a fluidRow and removing the width=50% from the individual output objects. A working example is given below, hope this...
View ArticleAnswer by Florian for in shiny, when i convert this logo to action button, a...
You could overwrite the background-color property by adding some additional CSS. Working example below, hope this helps!library(shiny)ui <- fluidPage( tags$a(href= NULL, tags$button(id =...
View ArticleAnswer by Florian for Double Head Slider Input is not picking up all the...
I expect that the error is not in your slider, but in the way you filter. Note that a slider returns the minimum and maximum values selected, and not all values in its range. So here,input$key would...
View ArticleAnswer by Florian for Problem using selectInput to download multiple...
Instead of switch I would recommend you to use named choices in your selectInput. Then you could get it working as in the example below. Note that this might need some error handling (e.g. no columns...
View ArticleAnswer by Florian for Store DenseVector in DataFrame column in PySpark
You could wrap the creation of the udf inside a function, so it returns the udf with your vector. An example is given below, hope this helps!import pyspark.sql.functions as Ffrom pyspark.ml.linalg...
View ArticleAnswer by Florian for How to extract the values of dynamically generated...
You can get the value of a dynamically generated input as input[[paste0(input$selected_var[i],"_weight")]]`while you can get the array with selected check boxes simply with input$selected_var. A...
View ArticleAnswer by Florian for How to make images clickable to display a subset...
It has been a while since I used Shiny so I may be a bit rusty. But here is a possible approach to tackling your issue: You could use a reactiveValue to keep track of which mood is selected, and update...
View ArticleAnswer by Florian for R shinydashboard - show/hide multiple menuItems based...
Here is an idea for growing your sidebarMenu dynamically using renderUI and uiOutput. It is also fairly straightforward to convert to a for loop if your number of tabs...
View ArticleAnswer by Florian for Replace any single digit value to NA in a column...
Maybe like this:dt$column[nchar(dt$column)==1 & nchar(gsub('[[:digit:]]', '', dt$column))==0]=NAIf the string is a single character, and after replacing the digits it is zero characters long,...
View ArticleAnswer by Florian for Rapid Selection of points from large numpy array
I believe this does what you want, see also here:pos_array = np.array(pos_list)arr[pos_array[:,0], pos_array[:,1],pos_array[:,2]]Output:array([0.10539037, 0.17852727, 0.18794522, 0.04191294])Or, you...
View ArticleAnswer by Florian for Mutate multiple columns with a certain condition in R
With base R:dt <- read.table(text="M1 M2 M3 UCL1 2 3 1.5",header=T)ncols <- ncol(dt)dt <- cbind(dt, ifelse(subset(df, select=M1:M3) > dt[,"UCL"], "UP", "NULL"))colnames(dt)[ncols:ncol(dt)]...
View ArticleAnswer by Florian for AWS Base Image Multiple Lambdas (dockerfile)
If you are using AWS CKD, you can overwrite it within fromImageAsset:import * as cdk from 'aws-cdk-lib';import { Construct } from 'constructs';import { Runtime } from 'aws-cdk-lib/aws-lambda';import...
View ArticleAnswer by Florian for Example of update_item in dynamodb boto3
Small update of Jam M. Hernandez Quiceno's answer, which includes ExpressionAttributeNames to prevent encoutering errors such as:"errorMessage": "An error occurred (ValidationException) when calling...
View ArticleHow to convert a Shiny app consisting of multiple files into an easily...
There are resources on how to create a Minimal, Complete, and Verifiable example in general on Stack Overflow, and on how to make a great R reproducible example. However, there are no similar...
View ArticleAnswer by Florian for Nodepool in AKS not scaling down to 0 nodes?
In the end, adding a dedicated system node pool did not resolve the issue. Initially the metrics-server pods were moved to the new node pool, but they ended up in the application node pool again later,...
View ArticleAnswer by Florian for Remove unused libraries python pyproject.toml
You can find obsolete dependencies by using deptry, a command line utility that checks for unused dependencies within a project's dependencies. It also checks for some other issues with the listed...
View ArticleAnswer by Florian for Get selected row value instead of number
I don't think you can. What you could do is write a reactive, where all modifications to your dataframe take place, before creating the datatable. An example:library(shiny)library(DT)ui <-...
View Article