2020-12-25

numpy数组创建
numpy.array(object, dtype=None, copy=True, order=‘K’,subok=False, ndmin=0)numpy参数名称、说明object 接收array。表示想要创建的数组。无默认。dtype 接收data-type。表示数组所需的数据类型。如果未给定,则选择保存对象所需的最小类型。默认为None。ndmin 接收int。指定生成数组应该具有的最小维数。默认为None。numpy数组创建的三种方法:(1)通过传入可待跌对象创建,我将之称为基本方法(2)使用numpy内部功能函数,内部方法(3)使用特殊的库函数,特殊方法变换数组的形态组合数组使用hstack函数实现数组横向组合:np.hstack((arr1,arr2))使用vstack函数实现数组纵向组合:np.vstack((arr1,arr2))使用concatenate函数实现数组横向组合:np.concatenate((arr1,arr2),axis = 1))使用concatenate函数实现数组纵向组合:np.concatenate((arr1,arr2),axis = 0))切割数组使用hsplit函数实现数组横向分割: np.hsplit(arr1, 2)使用vsplit函数实现数组纵向分割: np.vsplit(arr, 2)使用split函数实现数组横向分割: np.split(arr, 2, axis=1)使用split函数实现数组纵向分割: np.split(arr, 2, axis=0)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
func (c *cAsset) CreatComponent(r *ghttp.Request) { var req *v1.CreateComponentReq if err := r.Parse(&req); err != nil { r.Response.WriteJson(g.Map{ "code": 1, "msg": err.Error(), }) } createRequest := &creativecomponent.CreateRequest{ AdvertiserID: req.AdvertiserID, } res, err := service.Asset().Create(createRequest) if err != nil { r.Response.WriteJson(g.Map{ "code": 2, "msg": err.Error(), }) } r.Response.WriteJson(res) }这段代码中creativecomponent.CreateRequest的过滤条件为type CreateRequest struct { // AdvertiserID 广告主ID AdvertiserID uint64 `json:"advertiser_id,omitempty"` // ComponentInfo 组件信息 ComponentInfo *ComponentInfo `json:"component_info,omitempty"` },其中ComponentInfo为type ComponentInfo struct { // ComponentID 组件ID ComponentID model.Uint64 `json:"component_id,omitempty"` // ComponentType 组件类型 ComponentType enum.ComponentType `json:"component_type,omitempty"` // ComponentName 组件名称。长度小于等于20。一个中文长度为2 ComponentName string `json:"component_name,omitempty"` // ComponentData 组件详细信息。不同的component_type对应的值不同,具体的结构见创建或更新接口定义 ComponentData ComponentData `json:"component_data,omitempty"` // CreateTime 创建时间。格式"2020-12-25 15:12:08" CreateTime string `json:"create_time,omitempty"` // Status 组件审核状态。 Status enum.ComponentStatus `json:"status,omitempty"` }想要把ComponentInfo作为参数放到createRequest中,该怎么做?请详一点
07-20

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值