我想将numpy数组存储到另一个numpy数组中
我在用 np.concatenate
这是我的代码
x=np.concatenate(x,s_x)
Run Code Online (Sandbox Code Playgroud)
这些是类型和形状 x and s_x
Type of s_x: <class 'numpy.ndarray'>, Shape of s_x: (173,)
Type of x: <class 'numpy.ndarray'> (0,), Shape of x: (0,)
Run Code Online (Sandbox Code Playgroud)
这是显示的错误
TypeError: only integer scalar arrays can be converted to a scalar index
Run Code Online (Sandbox Code Playgroud) 我有一个类似的问题,例如How to upload a bytes image on Google Cloud Storage from a Python script。
我试过这个
from google.cloud import storage
import cv2
from tempfile import TemporaryFile
import google.auth
credentials, project = google.auth.default()
client = storage.Client()
# https://console.cloud.google.com/storage/browser/[bucket-id]/
bucket = client.get_bucket('document')
# Then do other things...
image=cv2.imread('/Users/santhoshdc/Documents/Realtest/15.jpg')
with TemporaryFile() as gcs_image:
image.tofile(gcs_image)
blob = bucket.get_blob(gcs_image)
print(blob.download_as_string())
blob.upload_from_string('New contents!')
blob2 = bucket.blob('document/operations/15.png')
blob2.upload_from_filename(filename='gcs_image')
Run Code Online (Sandbox Code Playgroud)
这是构成的错误
> Traceback (most recent call last): File
> "/Users/santhoshdc/Documents/ImageShapeSize/imageGcloudStorageUpload.py",
> line 13, in <module>
> blob = …Run Code Online (Sandbox Code Playgroud)