ValueError: could not convert string to float: id

I'm running the following python script: #!/usr/bin/python import os,sys from scipy import stats import numpy as np f=open('data2.txt', 'r').readlines() N=len(f)-1 for i in range(0,N): ...

Using Readline() and ReadKey() Simultaneously

Is there any way to detect both Readline and ReadKey, so that in most cases it behaves as a readline, except for some special key inputs that should be detected? I need some "parallel"...

How do I create a list of random numbers without duplicates?

I tried using random.randint(0, 100), but some numbers were the same. Is there a method/module to create a list unique random numbers? Note: The following code is based on an answer and has been...

How to print warning messages as they occur

I have the following code: urls <- c( "xxxxx", "http://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html", "http://en.wikipedia.org/wiki/Xz" ) readUrl <-...

Opening zipfile of unsupported compression-type silently returns empty filestream, instead of throwing exception

Seem to be knocking my head off a newbie error and I am not a newbie. I have a 1.2G known-good zipfile 'train.zip' containing a 3.5G file 'train.csv'. I open the zipfile and file itself without...

How do I correctly close a connection in R, so its connection 'slot' gets released?

I am using readLines(text url) in a script, where readLines(text url) is called several hundred times, where each text url is unique. After about 125 calls to readLines(text url) I got an error,...

R multiple urls into lapply

I have a list of urls in a character vector and I want to pause the process between queries because if not the x queries is rejected. urls=c('url1','url2','url3') here is want I want to...

Can't run rails c in terminal because of "Pry failed to get user input using `Readline`."

I can't seem to run rails c in terminal. It keeps giving me this error Loading development environment (Rails 4.2.0.beta2) [1] pry(main)> Error: Input/output error -...

Convert CSV column to list

Say I have a CSV file. It contains: a,b,c 1,2,3 4,5,6 7,8,9 How can I turn the column labeled 'a' into a list, without hard-coding a row to it? Originally, I was doing a readline for the first...

R: Read file without header

Someone has sent me a .txt file that has no header. Also, there is no structure, so all rows follow the previous one on the same line of the file. The only thing I know is that every 16 items...

Can the bash "autocomplete" (via TAB TAB) entries be colored/formated?

Background: The "autocomplete" feature I am talking about is when you half-type a command or filename in bash, if you press TAB twice it will print out suggestions. Question: The entries output...

A node shell based on gnu readline

Is there a shell for node which uses gnu readline internally? As you know node shell sucks in 2 ways (among others): It doesn't have search for history and it is not using gnu readline. Shells...

Node.js readline inside of promises

I'm trying to use the node.js package readline to get user input on the command line, and I want to pipe the entered input through promises. However, the input never gets through the then chain. I...

Read each line of a text file and then split each line by spaces in python

I am having a silly issue whereby I have a text file with user inputs structured as follows: x = variable1 y = variable2 and so on. I want to grab the variables, to do this I was going to just...

Does Python GC close files too?

Consider the following piece of Python (2.x) code: for line in open('foo').readlines(): print line.rstrip() I assume that since the open file remains unreferenced it has to be closed...

Return array from node.js readline module on close event

I'm calling a function on the server side that opens a csv file and searches for a string in each line. On the close event, the function should return an array that contains the first 5 string...

Kotlin readLine gives error in a basic program where input is taken from user and the same is shown as output

The following code : fun main(args: Array<String>) { print("Write anything here: ") val enteredString = readLine() println("You have entered this: $enteredString") } gives the following error in...

Failure to geocode using the ggmap and Google Geocoding API in R; behind company firewall

I am attempting to geocode addresses in R using the geocode() function in the ggmap package. I have done this on my personal computer relatively easily and want to attempt this on my work...

rbenv install 2.6.3 BUILD FAILED

I want to use rbenv for first time, install it and initialize it, after using rbenv install 2.6.3 (this version is in my list. rbenv install --list) I have BUILD FAILED (error about clang3.0 and...

Powershell find non-ASCII characters in text file

I am trying to find a way using Powershell Script to do the following. For each line in text file, check if line contains non-ASCII characters If line contains non-ASCII characters, output to...

Cannot load Doc2vec object using gensim

I am trying to load a pre-trained Doc2vec model using gensim and use it to map a paragraph to a vector. I am referring to https://github.com/jhlau/doc2vec and the pre-trained model I downloaded is...

Assigning worker names to groups based on the number of days they've worked

This will be hard to explain but please bare with me. I'm currently trying to complete a question for an online course and I have literally no idea what to do. The scenario of the question places...

Discord malware

A friend of mine contacted me with a problem he has been having with Discord. Windows asks what program the code below should be run with and the default is Discord. Every time Discord is run,...

Installing ruby with ruby-install causes error out on Mac M1

When installing ruby 2.6.6 or 2.7.2 using ruby-install on mac M1, the following error occurs. Ruby 3.0.0 works fine however anything older will error out with readline and not allow ruby to...

How to read lines in batches from a text file in Node.js

I am trying to figure out a way to open a Node.js Stream to read a text/CSV file as a Stream, so that: Read a batch of lines Pause the reading Do some async processing: Parse all lines to an...

ContentProvider for files on removable micro-sd card for Android 11+

As FileProvider cannot serve from micro-sd card one has to make its own extending ContentProvider. So i did time ago. And was working fine for all Android versions below 11. It can serve files...

PyTorch memory leak on loss.backward on both gpu as well as cpu

I've tried everything. gc.collect, torch.cuda.empty_cache, deleting every possible tensor and variable as soon as it is used, setting batch size to 1, nothing seems to work. I'm working on text to...

Problems aligning ggmap crs with geom_sf and applying map limits using coord_sf

I am trying to create a map with spatial data plotted on top. I am following the example using ggmap and then adding the New Zealand coastline using geom_sf. I have two problems: The projection...

Measure performance for small application

I wrote a statusbar for Sway WM (https://swaywm.org), basically print every second some information (loadavg, cpu usage, memory usage, time, ...). The project...

How can I Identify a line in a csv file based on a variable value and start iterating over the file lines from that line onwards in Groovy?

I am using Jmeter to send multiple HTTPS requests to some API. I need to compose the XML body of these requests with different data each time. I have a csv file which looks like...