Conny Gu

Conny Gu

JAVA_HOME Problem during Hadoop installation on windows

If you install the hadoop in windows, after the installation, you will confront this problem: you can not set the evironment valuable. This file won’t work: c:\deploy\etc\hadoop\hadoop-env.cmd If you do this step: “%HADOOP_PREFIX%\sbin\start-dfs.cmd” Then you will see a error message…

Read an Image with python

If you want to read an image, you will need the ‘image’ package: import Image read the image: Image.open(filename) convert the Image to grey scale: Image.open(filename).convert(‘L’) convert the image to array: numpy.asarray(Image.open(filename).convert(‘L’)) Notice: Here is a introduction to “Image” package…

sort 2d array in python

There are many ways to sort a 2d arrays. In general, you can use the sorted(), np.array.sort(),… But you should also understand what is meaning of list1.sort(list2) ravel() vs. flatten() what return the  key function back in sorted() what will…

the crazy * in zip()

I just want to reshape the List without use the numpy, so I found a piece of crazy code in stackoverflow: output: [(‘a’, ‘b’), (‘c’, ‘d’), (‘e’, ‘f’)] After the long consideration, I understand the code at last. The python…

the asterik * in python

Asterik in python is usually very confused for the beginner.  Some times it appears one time before a variable like *args, some times it appears two times like **args. Usually it appears in function definition: * and ** allow arbitrary…