python package install error and little code bugs

「爱情、让人受尽委屈。」 2023-08-17 16:37 192阅读 0赞

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

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

Here’s the solution: stackoverflow


The difference of ndarray declare.

  1. a = np.array([0,0,24])
  2. a.shape
  3. (3,)
  4. a
  5. array([ 0, 0, 24])
  6. a = np.array((1,2))
  7. a
  8. array([1, 2])
  9. a.shape
  10. (2,)

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

numpy.``array(object, dtype=None, copy=True, order=’K’, subok=False, ndmin=0)

  1. a = np.zeros([0,0,24])
  2. a.shape
  3. (0, 0, 24)
  4. a
  5. array([], shape=(0, 0, 24), dtype=float64)

numpy.``zeros(shape, dtype=float, order=’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.

转载于:https://www.cnblogs.com/dulun/p/11535756.html

发表评论

表情:
评论列表 (有 0 条评论,192人围观)

还没有评论,来说两句吧...

相关阅读