python package install error and little code bugs

When you install packages using setup.py, the error:

(py37) C:\Users\weda\Phd\python packages\visibility_graph-0.4>python setup.py install
Traceback (most recent call last):
File "setup.py", line 11, in 
long_description=readme(),
File "setup.py", line 5, in readme
return f.read()
File "C:\Users\weda\AppData\Local\Continuum\anaconda3\envs\py37\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1725: character maps to

Here's the solution:  stackoverflow


The difference of ndarray declare.

a = np.array([0,0,24])
a.shape
(3,)
a
array([ 0,  0, 24])

 

a = np.array((1,2))
a
array([1, 2])
a.shape
(2,)

There's no difference of passing parameter in () or [] format. And the first parameter represent the data value. 

numpy.array(objectdtype=Nonecopy=Trueorder='K'subok=Falsendmin=0)

a = np.zeros([0,0,24])
a.shape
(0, 0, 24)
a
array([], shape=(0, 0, 24), dtype=float64)

numpy.zeros(shapedtype=floatorder='C'); The first parameter is shape with [].

The problem when converting list into ndarray: list长度不规则


 另一个小问题,赋值问题,a = a.tolist(), dataframe = dataframe.drop([count]); 这些函数返回新的值,需要重新赋值。

list.remove(), the parameter is the value of deleted item and cannot be the index. Otherwise, you need to use 'del' function or 'pop' function. From here

 

posted @ 2019-09-17 19:38  keeps_you_warm  阅读(189)  评论(1编辑  收藏  举报