Concatenating two one-dimensional NumPy arrays

I have two simple one-dimensional arrays in NumPy. I should be able to concatenate them using numpy.concatenate. But I get this error for the code below: TypeError: only length-1 arrays can be converted to Python scalars Code import numpy a = numpy.array([1, 2, 3]) b = numpy.array([5, 6]) numpy.concatenate(a, b) Why? 6 Answers 6

Which is the preferred way to concatenate a string in Python?

Since Python’s string can’t be changed, I was wondering how to concatenate a string more efficiently? I can write like it: s += stringfromelsewhere or like this: s = [] s.append(somestring) # later s=””.join(s) While writing this question, I found a good article talking about the topic. http://www.skymind.com/~ocrow/python_string/ But it’s in Python 2.x., so the … Read more

Getting current date and time in JavaScript

I have a script that prints the current date and time in JavaScript, but the DATE is always wrong. Here is the code: var currentdate = new Date(); var datetime = “Last Sync: ” + currentdate.getDay() + “/” + currentdate.getMonth() + “/” + currentdate.getFullYear() + ” @ ” + currentdate.getHours() + “:” + currentdate.getMinutes() + … Read more