Select library column
I have a dataset in which one of the columns contains a library of different 'subcolumns'. For data preparation purposes, I want to extract certain parts of that column and store it into a new column. The data looks like this:
I'm looking to get a new, third, column that contains a header that says 'animal' and contains rows that say 'dog' and 'cat'. Like this:
Thanks in advance!
See also questions close to this topic
Spark, from training/testing loop to model, working to score in production
Suppose we trained/tested the model, found it good and we saved the trained and good model on a file system.
All that, using spark and spark ML lib. (python)
1) How do we start to use this model in production to process actual requests and predict? Can we use the same spark cluster(I mean load the model in another spark app and process online requests with this model)?
2) Should we in parallel run the training/testing on the more modern data and once in a while "refresh" the model we use in production? Is that acceptable solution?
3) I'm afraid online/production performance of python might be low, so is there way to speedup the execution in production? I mean trained model, could it be transferred to C or in other way "speed-improved"?
How can scroll a side scroll bar of web-page with selenium in python
I've tried to scroll a side bar (not full page) of a web-page but couldn't proceed.
element = driver.find_elements_by_css_selector(".sidebar-content > div:nth-child(3) > div:nth-child(1)")[-1] actions = ActionChains(driver) actions.move_to_element(element).perform()
Update dataframe value conditionaly with its own value
I have DF with float street numbers, sometime it is "NaN" or "x-y" (ex: 30-32) but often x.y (ex: 32.0 instead of 30) I need to change this to int (if there is no "-" in the number of course). Ive tried
chunk.loc["-" not in chunk["Street Number"] & chunk["Street Number"].notna(), 'Street Number'] = chunk["Street Number"].astype(int)
I know there is an issue after my "=" sign. How to update dataframe value conditionaly with its own value please ? Ive also tried with
There is no error
Sample of DF :
0 | NaN
1 | 1.0
2 | 6.0
3 | 170.0
4 | 61.0
5 | 51-52
I tried to force dtype "Street Number": np.uint16 but I got ValueError: Integer column has NA values in column 12
Adding a responsive sidebar to a Leaflet application in R
I am building a Leaflet application in R. I want polygons in my map to be clickable. A side bar should then show additional information about the clicked element.
Hot to fix "Error in tabulate(phy$edge[, 1]) : 'bin' must be numeric or a factor" in "comparative.data"
I'm using comparative.data to overlap my phylogenentic tree and my data, but it's not working
"Error in tabulate(phy$edge[, 1]) : 'bin' must be numeric or a factor".
I don't know where my mistake is.
I'm building a phylogenetic tree with ape package, I cutted tips using drop.tip, then when I tried to use my new cutted tree and my data to overlap them with "comparative.data" an error message appears:
"Error in tabulate(phy$edge[, 1]) : 'bin' must be numeric or a factor".
Afterwards, I converted them into factor or numeric with as.factor/as.numeric, but the feedback says "numeric (0)" and "factor(0) Levels:". I don't know what else to do.
library(ape) lizardtree= read.tree("all_tree_ALF.new") lizards= read.table("LIZARD_DIET.csv", sep= ",", header= T, dec=".") delete1= c("Dibamus_bourreti", "Dibamus_greeri", "Dibamus_montanus",[...] . . . delete48= c([...]"Anolis_tropidogaster", "Anolis_trachyderma", "Anolis_poecilopus") deletefinal= c(delete1, delete2,[...],delete48) lizardtreefinal= plot(drop.tip(lizardtree, deletefinal),cex= 0.4) arbollagarto= dplyr::select(lizards,"EMBL.PYRON.13","MAX.FO") lagartos= na.omit(arbollagarto) lagartoyarbol= comparative.data(phy= lizardtreefinal, data= lagartos, names.col= EMBL.PYRON.13, vcv=T)
I need the data and the tree to be overlapped to use Pagel's Lambda, but everytime I get
"Error in tabulate(phy$edge[, 1]) : 'bin' must be numeric or a factor"
or when I try to change the cutted tree into "phylo" with as-phylo
"Error in UseMethod("as.phylo") : no applicable method for 'as.phylo' applied to an object of class "list"
seemed to work but I get again 'bin' must be numeric...
and i get this error message : rror: unexpected ','
Do you understand what is the problem ? :) Thank you !!!
library(ggplot2) df <- data.frame(stringsAsFactors=FALSE, INTER1 = c(1, 2, 3, 4, 7, 8), LATITUDE = x, LONGITUDE = y) eastern_map + geom_point(data = df, aes(x = LONGITUDE, y = LATITUDE, color = INTER1)), size=1, alpha=0.5 + theme(legend.position = "bottom")
and i get this error message :
rror: unexpected ',' in:
"eastern_map + geom_point(data = df, aes(x = LONGITUDE, y = LATITUDE, color = INTER1)),"
r centroid cluster method dendrogram is looking so bad
i want to make a centroid method dendrogram for cluster analysis. but dendrogram shape is here. it looks so bad.
library(cluster) # clustering algorithms library(factoextra) # clustering algorithms & visualization library(readxl) u <- read_excel("C:/v.xlsx") cvbb<-u[,4:43] cl<-hclust(dist(scale(cvbb)),"centroid" ) plot(cl, hang = -1)
and result is very bad dendrogram i have to fix it: https://ibb.co/WtVVsxz
What language to use to grab data from an API (every x seconds) and how to live analyse it with an weboverlay?
So I want to as the questions says use an API (the Riot api) get the data, which I want to display.
I did use an api multiple times and with different languages but I dont know which one I should use for such purpose... I guess I should use an serversided language to get the data from the api (thinking about python) and then some JS to analyse it and create the webpage. Also I am not sure how to store the data, that I am able to adjust it every x seconds... Maybe a database? But this would lead to PHP regarding the website right?
I know the question is kind of odd but I don't know how to ask it differently...
(And sry for my english I am from germany)
Thx for all answers
How to analyze volatiles in R?
I have a volatile blend of old and young plants (o,y) and 3 Treatments A,B,C(the same in old and young plants) and now I want to analyze the effects of Age and Treatment on quality and quantity of the volatiles. With which statistical test could I solve that? and further how can I identify the interesting volatiles for old/Treatment C and young/Treatment C?
I tried to do a PCA but then I am afraid that not all volatiles that have an influence are actually addressed. Further I did a MVA to compare the groups. Now I don't know if that makes sense and how to proceed. Additionally I tried to create a heatmap with the mixomics package but there is an error.
# First pair of components plotDiablo(DIABLO,ncomp=1) # Second pair of components plotDiablo(DIABLO,ncomp=2) class(DIABLO) <- "block.splsda" # R-related step circosPlot(DIABLO,cutoff=0.2,line=FALSE) cimDiablo(DIABLO) network(DIABLO,cutoff=0.8)
> class(DIABLO) <- "block.splsda" # R-related step > circosPlot(DIABLO,line=FALSE) Error: 'cutoff' is missing > circosPlot(DIABLO,cutoff=0.2,line=FALSE) Error: Column names `Compound_1`, `Octane`, `3-Hexen-1-ol, (Z)`, `Cyclopentane, 1,2,3,4,5-pentamethyl`, `Nonanal`, ... (and 4 more) must not be duplicated. Use .name_repair to specify repair. Call `rlang::last_error()` to see a backtrace