我将numpy升级到最新版本,现在我在导入numpy时遇到以下错误:
AttributeError:类型对象'numpy.ndarray'没有属性' array_function '
我正在使用numpy版本1.16.
我正在读取一个视频文件,每 20 帧我将第一帧存储在输入队列中。一旦我在输入队列中获得了所有必需的帧,我就会运行多个进程来对这些帧执行一些操作并将结果存储在输出队列中。但代码总是卡在 join 处,我尝试了针对此类问题提出的不同解决方案,但似乎都不起作用。
import numpy as np
import cv2
import timeit
import face_recognition
from multiprocessing import Process, Queue, Pool
import multiprocessing
import os
s = timeit.default_timer()
def alternative_process_target_func(input_queue, output_queue):
while not output_queue.full():
frame_no, small_frame, face_loc = input_queue.get()
print('Frame_no: ', frame_no, 'Process ID: ', os.getpid(), '----', multiprocessing.current_process())
#canny_frame(frame_no, small_frame, face_loc)
#I am just storing frame no for now but will perform something else later
output_queue.put((frame_no, frame_no))
if output_queue.full():
print('Its Full ---------------------------------------------------------------------------------------')
else:
print('Not Full')
print(timeit.default_timer() - s, ' seconds.') …Run Code Online (Sandbox Code Playgroud) 我有一个像下面这样的pandas数据帧:
Customer Id year
0 1510220024 2017
1 1510270013 2017
2 1511160047 2017
3 1512100014 2017
4 1603180006 2017
5 1605030030 2017
6 1605160013 2017
7 1606060008 2017
8 1510220024 2018
9 1606270014 2017
10 1608080011 2017
11 1608090002 2017
12 1511160047 2018
13 1606270014 2018
Run Code Online (Sandbox Code Playgroud)
我想从上面的数据框构建以下矩阵:
2017 2018
2017 11 3
2018 3 3
Run Code Online (Sandbox Code Playgroud)
该矩阵表明2017年共有11个客户,其中3个也出现在2018年,依此类推.实际上,我有7年的数据,所以它将是7x7矩阵.我现在正在努力一段时间,但无法做到这一点.
我正在使用以下代码使用 plotly express line 显示时间序列数据。
fig = px.line(df, x="date", y="close", color="type" ,category_orders = co ,color_discrete_sequence = colors,
line_group="type", title = company)
fig.update_layout(height=500, width=1500)#hovermode="x unified"
fig.show()
Run Code Online (Sandbox Code Playgroud)
但是在悬停时的绘图中,它以以下格式显示日期:“月,年”,即它不显示日期。但我希望以以下格式显示日期:“月日,年”。