load csv into 2D matrix with numpy for plotting

Pure numpy Check out the loadtxt documentation. You can also use python’s csv module: You will have to convert it to your favorite numeric type. I guess you can write the whole thing in one line: result = numpy.array(list(csv.reader(open(“test.csv”, “rb”), delimiter=”,”))).astype(“float”) Added Hint: You could also use pandas.io.parsers.read_csv and get the associated numpy array which can be faster.

Removing Conda environment

I want to remove a certain environment created with conda. How can I achieve that? Let’s say I have an active testenv environment. I tried, by following documentation, with: I then deactivate it: I try running again the command to remove it and I still get the same error. What is going wrong here?

Python calling method in class

The first argument of all methods is usually called self. It refers to the instance for which the method is being called. Let’s say you have: Then, doing: There’s nothing special about this being called self, you could do the following: Then, doing: In your specific case: (As suggested in comments MissileDevice.RIGHT could be more appropriate here!) You could declare all … Read more

how can I translate efficiently a Java code to python?

If you want to translate java code to python you have to translate it manually. Automatic conversion generally does not have the appropriate quality. It looks like there are some tools out e.g. java2python but the author states The generated Python code is not guaranteed to run, nor is guaranteed to be syntactically valid Python. Converting a … Read more

Could not find a version that satisfies the requirement

This approach (having all dependencies in a directory and not downloading from an index) only works when the directory contains all packages. The directory should therefore contain all dependencies but also all packages that those dependencies depend on (e.g., six, pytz etc). You should therefore manually include these in requirements.txt (so that the first step downloads them explicitly) or you … Read more