I have a general question about principal component analysis (PCA): I know PCA give us a direction that data have the most variation in that direction. Can PCA give us an order for features from the most important one to the least? For example, if I have 8 features, f1, ..., f8, it gives me f5 is the most important, then f3, then f8, then f4, etc. If yes, what function should I call in R?
I have configured and working following setup gitlab-ci, which uses docker-machine runner and uploads cache to S3 maven build with configured caching caching correctly loads and uploads on each job But the problem is, that every time I run mvn install, something in the local maven repository changes (I assume it updates pom metadata) and gitlab runner keeps uploading new versions of the cache, on every single build. It is still faster and more reliable to use this "busted" cache, than to download the deps from internet every time, but the upload can take a long time and I would like to shave o
I want to import data from google drive to a data frame. But my code breaks down at the 'from google.colab import auth' step. It says google.colab module not found. Tried suggestions at How to resolve: ModuleNotFoundError: No module named 'google.colab' from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth auth.authenticate_user() import gspread from oauth2client.client import GoogleCredentials gc = gspread.authorize(GoogleCredentials.get_application_default()) Error message: ModuleNotFoundError: No module named 'google.colab'
I was experimenting with variable initialization in Python and I came across a scenario where the id(integers) in a certain range would be the same and the id(integers) greater than 256, Python creates a new reference. Ex: >>>> a = 2 >>>> b = 2 >>>> id(a) == id(b) True >>>> a = 257 >>>> b = 257 >>>> id(a) == id(b) False Reading through the documentation, it is clear that Python caches small integer values during initialization. https://hg.python.org/cpython/file/tip/Objects/longobject.c#l5343 Why does Python internally cache only integer values in the range [-5, 257) During initialization? Als
I was experimenting with variable initialization in Python and I came across a scenario where the id(integers) in a certain range would be the same and the id(integers) greater than 256, Python creates a new reference. Ex: >>>> a = 2 >>>> b = 2 >>>> id(a) == id(b) True >>>> a = 257 >>>> b = 257 >>>> id(a) == id(b) False Reading through the documentation, it is clear that Python caches small integer values during initialization. https://hg.python.org/cpython/file/tip/Objects/longobject.c#l5343 Why does Python internally cache only integer values in the range [-5, 257) During initialization? Als
I have pyenv installed on an up to date debian testing distribution, and have python 2.7.1 in it. I create a virtualenv for a project with this version, but when activated it gives me the python system version (3.7). Here is what I did: $ pyenv virtualenv 2.7.16 my_project-2.7 Requirement already satisfied: virtualenv in /home/user/.local/lib/python2.7/site-packages (15.1.0) You are using pip version 18.1, however version 19.1.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Using base prefix '/usr' New python executable in /home/user/.pyenv/versions/2
I'm beginner in python3 and I have a project to convert word files (doc.x) to pdf files on mac. I saw few codes that relevant to windows but didn't succeeding adapt it to mac. someone can help me?
I'm studying the restful API. In this project, I wanna log-in using restful API. So, I made two projects. The one is spring MVC. It just shows the web page. Another is the restful API. And It worked well but when I call the web page, it doesn't work. I found several solutions, but those not for me. The one checks import org.springframework.web.servlet.ModelAndView. I already used it. Another used String as the return type in the controller instead of ModelAndView. This is my Controller. @Controller public class LoginController { @RequestMapping(value = "/login", method = RequestMethod.GET) pub
I am trying to write a Python program to gather data from Google Trends (GT)- specifically, I want to automatically open URLs and access the specific values that are displayed in the line graphs: I would be happy with downloading the CSV files, or with web-scraping the values (based on my reading of Inspect Element, cleaning the data would only require a simple split or two). I have many searches I want to conduct (many different keywords) I am creating many URLs to gather data from Google Trends. I used the actual URL from a test search. Example of a URL: https://trends.google.com/trends/expl
I'm using DBeaver PostgreSQL and I'm trying to join two CSV files but I get an error stating, "SQL Error: Syntax error: JOIN not supported". In addition, I am unable to run window functions. SQL Error: Syntax error: JOIN not support SQL Window Function Error:
I'm using httpcore-nio-4.4.5.jar. I'm using the elasticsearch RestHighLevelClient to interact with our elasticsearch servers. This all works fine except for some time we get I/O reactor stopped error out of a sudden. Everything seems fine on ES side. No strange behaviour. That's how i'm initializing my ES client. public synchronized RestHighLevelClient getHighLevelClient() throws ManagerException { if (highLevelClient != null) { return highLevelClient; } Map<String, Integer> map = getEsServers(esAddresses); HttpHost[] hosts = new HttpHost[map.size()]; int i = 0; for (Map.Entry<String, Integer>
when I run the command npm install -g vue-cli I get the following warning, apparently I have no errors but when executing vue init webpack my-project or vue --version this pops up
After deploying my spring boot on google cloud platform app engine 'standard', and then try to visit the website I get Error: Server Error in browser. Then I visit the log on google cloud I get error: "logMessage": "org.eclipse.jetty.annotations.ServletContainerInitializersStarter doStart: \norg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceE
I am trying to make a script file. Everything works fine, but it only starts from the terminal. I already made it executable using chmod +x filename.sh, but it won't run. I saw a solution: xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default \ --create --type bool --set true ' But even this doesn't work.
After searching a lot I couldn't find a simple way to extract data from .h5 and pass it to a data.Frame by Numpy or Pandas in order to save in .txt or .csv file. import h5py import numpy as np import pandas as pd filename = 'D:\data.h5' f = h5py.File(filename, 'r') # List all groups print("Keys: %s" % f.keys()) a_group_key = list(f.keys())[0] # Get the data data = list(f[a_group_key]) pd.DataFrame(data).to_csv("hi.csv") Keys: <KeysViewHDF5 ['dd48']> When I print data I see following results: print(data) ['axis0', 'axis1', 'block0_items', 'block0_values', 'block1_items', 'block1_values'] I woul
When trying to use the new useSelector hook (see below example) of react-redux typescript gives an error that the function does not exist: Module '"../../../node_modules/@types/react-redux"' has no exported member 'useSelector'. TS2305 Example: import * as React from "react" import { useSelector } from "react-redux" import { Message } from "./Message" export const MessageContainer = () => { const searchValue = useSelector((state) => state.search) return ( <Message searchValue={searchValue} /> ) } Used versions: "react-redux": "^7.1.0-alpha.5" "@types/react-redux": "^7.0.9"
How can I use the LaTeX package bbm in an R markdown for html/docx output? Currently I'm using the hack solution below where, essentially, I just abandon using the package bbm for .docx/.html output. Is there a hack solution in which I can still use the package? Note, this question related to my question In an R Markdown document, “includes” for docx output? where there I'm specifically asking about how to move these special <!--- For DOCX Only ---> code chunk to a preamble-word.tex file to be indcluded in the YAML header. This question is also related to the question How to get \bm{} to work
Just I want to add input value using javascript. Here's priject link!> add to cart > Proceed to Checkout || then you get the checkout page. Actually I want to add automatically Zipcode value in the checkout page. I try this methood but dosen’t work document.querySelector('#shipping-new-address-form div:nth-child(8) input').value = '12345'; Can anyone help to solve this issue?
I'm trying to make a map in Folium with multiple layers, each consisting of shaded areas (using GeoJSON) with colors given by a colormap. I'd like to add legends to my layers. I found a first solution here, but the problem with this solution were that the legend is fixed at the top right and more importantly, that it's always there. Instead, I'd like a legend that is only shown when the corresponding layer is shown. Here is some example code that I tried (where m is my Folium map and cm1 and cm2 are color maps): folium.GeoJson(data['Temp'], name='Temp', style_function=lambda x: { 'fillColor':
Going through some C interview questions, I've found a question stating "How to find the size of an array in C without using the sizeof operator?", with the following solution. It works, but I cannot understand why. #include <stdio.h> int main() { int a[] = {100, 200, 300, 400, 500}; int size = 0; size = *(&a + 1) - a; printf("%d\n", size); return 0; } As expected, it returns 5. edit: people pointed out this answer, but the syntax does differ a bit, i.e. the indexing method size = (&arr)[1] - arr; so I believe both questions are valid and have a slightly different approach to the problem. Than
I am trying to perform a egger's test with the following function: eggers.test<-function(data){data<-data eggers<-metabias(data) intercept<-as.numeric(eggers$estimate[1]) intercept<-round(intercept,digits=3) se.intercept<-eggers$estimate[2] lower.intercept<-as.numeric(intercept-1.96*se.intercept) lower.intercept<-round(lower.intercept,digits = 2) higher.intercept<-as.numeric(intercept+1.96*se.intercept) higher.intercept<-round(higher.intercept,digits = 2) ci.intercept<-paste(lower.intercept,"-",higher.intercept) ci.intercept<-gsub(" ", "", ci.intercept, fixed = TRUE) intercept.pval<-as.numeric
Is there a way to set a CSS color using a color text name and also set opacity? Something like: color: lightgray alpha 0.5 Or do I have to use RGBalpha, like: color: rgba(211,211,211,0.3)
I was trying to make my first discord bot. I got this error: NameError: name 'exceptions' is not defined. It was in __init__. I guess that something is wrong with names. Here's how my __init__ looks like: from .client import * from .exceptions import * from .protocol import * from .server import * from .uri import * from .version import version as __version__ # noqa __all__ = ( client.__all__ + exceptions.__all__ + protocol.__all__ + server.__all__ + uri.__all__ ) If I need to add something else, tell me in comments.
I am trying to clone some repo from GitHub, but I am getting error like: fatal: unable to access 'https://github.com/some/thing.git/': Received HTTP code 403 from proxy after CONNECT I am behind corporate proxy, but I set it already in .gitconfig. This is inside my .gitconfig: [http] proxy = http://something.com:80 [https] proxy = http://something.com:80 Do you have any idea?
Overview I am having trouble loading Python TensorFlow from the tensorflow R package. library(tensorflow) sess <- tf$Session() #> Error: Installation of TensorFlow not found. #> #> Python environments searched for 'tensorflow' package: #> /home/[username]/anaconda3/envs/r-tensorflow/bin/python3.7 #> /usr/bin/python2.7 #> /usr/bin/python2.7 #> /usr/bin/python3.4 #> /home/[username]/anaconda3/bin/python3.7 #> /[censored]/apps/python/python-3.6.5/bin/python3.6 #> #> You can install TensorFlow using the install_tensorflow() function. I have fresh local installations of Anaconda 3, Python 3.7.3, an
I am trying to create PySpark dataframe by using the following code #!/usr/bin/env python # coding: utf-8 import pyspark from pyspark.sql.session import SparkSession import pyspark.sql.functions as f from pyspark.sql.functions import coalesce spark = SparkSession.builder.appName("Test").enableHiveSupport().getOrCreate() #spark.sql("use bocconi") tableName = "dynamic_pricing.final" inputDF = spark.sql("""SELECT * FROM dynamic_pricing.final WHERE year = '2019' AND mercati_id = '6'""") I get the following error: Py4JJavaError: An error occurred while calling o48.sql. : org.apache.spark.SparkExcep
We have two offices which are linked by a secured VPN (I'm not IT, so I'll try to explain as best I can). During a recent audit, it was noted our file transfers of PDF files to the printers in the other office were open to packet sniffing at the switches, which is prior/after connection to the VPN. To ensure security, a recommendation was to use IPP to submit the files directly to the printer. I've tried various techniques, but I cannot find a solution to using IPP with C#. Is this possible or should I look for an alternate solution?
Problem Let's make a basic list and sort it to make sure that 2 is ALWAYS first in the list. Simple enough, right? [1, 2, 3].sort((a, b) => { if (a === 2) return -1; return 0; }); Chrome result: ✓ [2, 1, 3] Node result: X [1, 2, 3] In order to get this behaviour in Node, you could - weirdly enough - look at the b parameter and make it return 1 if it's 2: [1, 2, 3].sort((a, b) => { if (b === 2) return 1; return 0; }); With this implementation you get the opposite result; Chrome will be [1, 2, 3] and Node will be [2, 1, 3]. Questions Do you have a logical explaination for this behaviour? Is my s
Due to optimization reasons I want my vector to exist in the cache, and having it on the stack greatly increases the odds of that. Is it possible to create a vector on the stack? I'm completely willing to re-implement my own variant of std::vector if necessary to make it work out. I'm also comfortable using inline assembly if necessary.