草庐IT

【数模之数据分析-2】

lxw-pro 2024-01-18 原文

数据分析之Numpy


个人昵称:lxw-pro
个人主页:欢迎关注 我的主页
个人感悟: “失败乃成功之母”,这是不变的道理,在失败中总结,在失败中成长,才能成为IT界的一代宗师。

import numpy as np		# 导入Numpy库

四则运算:

x = np.array([3, 5])
y = np.array([6, 2])

# 列相乘
xc = np.multiply(x, y)
print(xc)

# 列乘后相加
qxc = np.dot(x, y)
print(qxc)

print(x.shape)
print(y.shape)


# 一维与二维相乘
x = np.array([2, 3, 4])
y = np.array([
    [1, 2, 3],
    [2, 3, 4]
])
print(x * y)

# 辨别x和y2是否一样
y2 = np.array([2, 4, 9])
print(x == y2)

# 与
yy = np.logical_and(x, y2)
print(yy)

# 或
hh = np.logical_or(x, y2)
print(hh)

# 非
ff = np.logical_not(x, y2)
print(ff)

相关程序运行如下:

[18 10]
28
(2,)
(2,)
[[ 2  6 12]
 [ 4  9 16]]
[ True False False]
[ True  True  True]
[ True  True  True]
[0 0 0]

print()

随机模块:

sj = np.random.rand(2, 6)               # 所有的值都是0从1
print(sj)

yx = np.random.randint(8, size=(5, 3))  # 返回的是随机的整数,左闭右开
print(yx)

# 随机数
s = np.random.rand()
print(s)

# 随机样本
yb = np.random.random_sample()
print(yb)

# 区间内的随机数
qjs = np.random.randint(0, 10, 6)
print(qjs)

# 高斯分布
mu, sigma = 0, 0.1
fb = np.random. normal(mu, sigma, 8)
print(fb)

# 指定精度
zd = np.set_printoptions(precision=3)
print(fb)


# 洗牌
xps = np.arange(10)
np.random.shuffle(xps)
print(xps)

# 随机的种子
np.random.seed(100)
mu, sigma = 0, 0.1
z = np.random.normal(mu, sigma, 8)
print(z)

相关程序运行如下:

[[0.63334441 0.85097104 0.59019264 0.310542   0.90493224 0.64755   ]
 [0.26229661 0.22710308 0.8936011  0.42837496 0.06484865 0.01209753]]
[[3 5 4]
 [6 4 0]
 [5 3 5]
 [4 2 7]
 [2 0 3]]
0.5814122350900927
0.37162507133518075
[1 0 1 4 6 2]
[ 0.04351687 -0.02026214  0.02332794 -0.09842403  0.06876269  0.02239188
 -0.06339656  0.11343825]
[ 0.044 -0.02   0.023 -0.098  0.069  0.022 -0.063  0.113]
[6 2 4 3 7 0 1 5 8 9]
[-0.175  0.034  0.115 -0.025  0.098  0.051  0.022 -0.107]

print()

文件读写:

data = []
with open('np2.txt') as f:
    for line in f:
        fil = line.split()
        f_data = [float(i) for i in fil]
        data.append(f_data)
data = np.array(data)
print(data)

# 法二--简便
# delimiter 分隔符     |   skiprows=1  去掉几行    |   usecols = (0, 1, 4) 指定使用哪几列
data = np.loadtxt('np2.txt', delimiter=' ', skiprows=1)
print(data)

相关程序运行如下:

[[1. 2. 3. 4. 5. 6.]
 [4. 5. 6. 7. 8. 9.]]
[4. 5. 6. 7. 8. 9.]

print()

数组保存:

xr = np.array([
    [1, 2, 3],
    [6, 7, 8]
])
np.savetxt('np2_1.txt', xr)

np.savetxt('np2_2.txt', xr, fmt='%d')

np.savetxt('np2_3.txt', xr, fmt='%d', delimiter=',')

np.savetxt('np2_4.txt', xr, fmt='%.2f', delimiter=' ')

# 读写array结构
dx_array = np.array([
    [5, 2, 0],
    [1, 4, 9]
])
np.save('np2_1.npy', dx_array)

dx = np.load('np2_1.npy')
print(dx)

相关程序运行如下:




[[5 2 0]
 [1 4 9]]

Numpy练习题:

import numpy as np			# 导入Numpy库

1-打印当前Numpy版本

print(np.__version__)

2-构造一个全零的矩阵,并打印其占用的内存大小

ojz = np.zeros((5, 5))
print(ojz)
print("%d bytes" % (ojz.size*ojz.itemsize))

3-打印一个函数的帮助文档,比如numpy.add

bz = help(np.info(np.add))
print(bz)

4-创建一个2~20的数组,并将其逆序

sz = np.arange(2, 21, 1)
print(sz)
sz = sz[::-1]
print(sz)

5-找到一个数组中不为0的索引

sy = np.nonzero([2, 53, 12, 43, 0, 0, 0, 23, 90])
print(sy)

相关程序运行如下:

1.22.3
[[0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]]
200 bytes
add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])

Add arguments element-wise.

Parameters
----------
x1, x2 : array_like
    The arrays to be added.
    If ``x1.shape != x2.shape``, they must be broadcastable to a common
    shape (which becomes the shape of the output).
out : ndarray, None, or tuple of ndarray and None, optional
    A location into which the result is stored. If provided, it must have
    a shape that the inputs broadcast to. If not provided or None,
    a freshly-allocated array is returned. A tuple (possible only as a
    keyword argument) must have length equal to the number of outputs.
where : array_like, optional
    This condition is broadcast over the input. At locations where the
    condition is True, the `out` array will be set to the ufunc result.
    Elsewhere, the `out` array will retain its original value.
    Note that if an uninitialized `out` array is created via the default
    ``out=None``, locations within it where the condition is False will
    remain uninitialized.
**kwargs
    For other keyword-only arguments, see the
    :ref:`ufunc docs <ufuncs.kwargs>`.

Returns
-------
add : ndarray or scalar
    The sum of `x1` and `x2`, element-wise.
    This is a scalar if both `x1` and `x2` are scalars.

Notes
-----
Equivalent to `x1` + `x2` in terms of array broadcasting.

Examples
--------
>>> np.add(1.0, 4.0)
5.0
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(3.0)
>>> np.add(x1, x2)
array([[  0.,   2.,   4.],
       [  3.,   5.,   7.],
       [  6.,   8.,  10.]])

The ``+`` operator can be used as a shorthand for ``np.add`` on ndarrays.

>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(3.0)
>>> x1 + x2
array([[ 0.,  2.,  4.],
       [ 3.,  5.,  7.],
       [ 6.,  8., 10.]])
Help on NoneType object:

class NoneType(object)
 |  Methods defined here:
 |  
 |  __bool__(self, /)
 |      self != 0
 |  
 |  __repr__(self, /)
 |      Return repr(self).
 |  
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |  
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.

None
[ 2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20]
[20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2]
(array([0, 1, 2, 3, 7, 8], dtype=int32),)


6-随机构造一个3*3矩阵,并打印其中最大与最小值

zz = np.random.random((3, 3))
print(zz.max())
print(zz.min())

7-构造一个5*5的矩阵,令其值都为1,并在最外层加上一圈0

jz = np.ones((5, 5))
jz = np.pad(jz, pad_width=1, mode='constant', constant_values=0)
print(jz)
print(help(np.pad))     # 帮助文档

8-构造一个shape为(6, 7, 8)的矩阵,并找到第100个元素的索引值

sy8 = np.unravel_index(100, (6, 7, 8))
print(sy8)

9-对一个5*5的矩阵做归一化操作

cz = np.random.random((5, 5))
cz_max = cz.max()
cz_min = cz.min()
cz = (cz-cz_min)/(cz_max-cz_min)
print(cz)

10-找到两个数组中相同的值

sz1 = np.random.randint(0, 20, 8)
sz2 = np.random.randint(0, 20, 8)
print(sz1)
print(sz2)

print(np.intersect1d(sz1, sz2))

相关程序运行如下:

0.9786237847073697
0.10837689046425514
[[0. 0. 0. 0. 0. 0. 0.]
 [0. 1. 1. 1. 1. 1. 0.]
 [0. 1. 1. 1. 1. 1. 0.]
 [0. 1. 1. 1. 1. 1. 0.]
 [0. 1. 1. 1. 1. 1. 0.]
 [0. 1. 1. 1. 1. 1. 0.]
 [0. 0. 0. 0. 0. 0. 0.]]
Help on function pad in module numpy:

pad(array, pad_width, mode='constant', **kwargs)
    Pad an array.
    
    Parameters
    ----------
    array : array_like of rank N
        The array to pad.
    pad_width : {sequence, array_like, int}
        Number of values padded to the edges of each axis.
        ((before_1, after_1), ... (before_N, after_N)) unique pad widths
        for each axis.
        ((before, after),) yields same before and after pad for each axis.
        (pad,) or int is a shortcut for before = after = pad width for all
        axes.
    mode : str or function, optional
        One of the following string values or a user supplied function.
    
        'constant' (default)
            Pads with a constant value.
        'edge'
            Pads with the edge values of array.
        'linear_ramp'
            Pads with the linear ramp between end_value and the
            array edge value.
        'maximum'
            Pads with the maximum value of all or part of the
            vector along each axis.
        'mean'
            Pads with the mean value of all or part of the
            vector along each axis.
        'median'
            Pads with the median value of all or part of the
            vector along each axis.
        'minimum'
            Pads with the minimum value of all or part of the
            vector along each axis.
        'reflect'
            Pads with the reflection of the vector mirrored on
            the first and last values of the vector along each
            axis.
        'symmetric'
            Pads with the reflection of the vector mirrored
            along the edge of the array.
        'wrap'
            Pads with the wrap of the vector along the axis.
            The first values are used to pad the end and the
            end values are used to pad the beginning.
        'empty'
            Pads with undefined values.
    
            .. versionadded:: 1.17
    
        <function>
            Padding function, see Notes.
    stat_length : sequence or int, optional
        Used in 'maximum', 'mean', 'median', and 'minimum'.  Number of
        values at edge of each axis used to calculate the statistic value.
    
        ((before_1, after_1), ... (before_N, after_N)) unique statistic
        lengths for each axis.
    
        ((before, after),) yields same before and after statistic lengths
        for each axis.
    
        (stat_length,) or int is a shortcut for before = after = statistic
        length for all axes.
    
        Default is ``None``, to use the entire axis.
    constant_values : sequence or scalar, optional
        Used in 'constant'.  The values to set the padded values for each
        axis.
    
        ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants
        for each axis.
    
        ``((before, after),)`` yields same before and after constants for each
        axis.
    
        ``(constant,)`` or ``constant`` is a shortcut for ``before = after = constant`` for
        all axes.
    
        Default is 0.
    end_values : sequence or scalar, optional
        Used in 'linear_ramp'.  The values used for the ending value of the
        linear_ramp and that will form the edge of the padded array.
    
        ``((before_1, after_1), ... (before_N, after_N))`` unique end values
        for each axis.
    
        ``((before, after),)`` yields same before and after end values for each
        axis.
    
        ``(constant,)`` or ``constant`` is a shortcut for ``before = after = constant`` for
        all axes.
    
        Default is 0.
    reflect_type : {'even', 'odd'}, optional
        Used in 'reflect', and 'symmetric'.  The 'even' style is the
        default with an unaltered reflection around the edge value.  For
        the 'odd' style, the extended part of the array is created by
        subtracting the reflected values from two times the edge value.
    
    Returns
    -------
    pad : ndarray
        Padded array of rank equal to `array` with shape increased
        according to `pad_width`.
    
    Notes
    -----
    .. versionadded:: 1.7.0
    
    For an array with rank greater than 1, some of the padding of later
    axes is calculated from padding of previous axes.  This is easiest to
    think about with a rank 2 array where the corners of the padded array
    are calculated by using padded values from the first axis.
    
    The padding function, if used, should modify a rank 1 array in-place. It
    has the following signature::
    
        padding_func(vector, iaxis_pad_width, iaxis, kwargs)
    
    where
    
        vector : ndarray
            A rank 1 array already padded with zeros.  Padded values are
            vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:].
        iaxis_pad_width : tuple
            A 2-tuple of ints, iaxis_pad_width[0] represents the number of
            values padded at the beginning of vector where
            iaxis_pad_width[1] represents the number of values padded at
            the end of vector.
        iaxis : int
            The axis currently being calculated.
        kwargs : dict
            Any keyword arguments the function requires.
    
    Examples
    --------
    >>> a = [1, 2, 3, 4, 5]
    >>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6))
    array([4, 4, 1, ..., 6, 6, 6])
    
    >>> np.pad(a, (2, 3), 'edge')
    array([1, 1, 1, ..., 5, 5, 5])
    
    >>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4))
    array([ 5,  3,  1,  2,  3,  4,  5,  2, -1, -4])
    
    >>> np.pad(a, (2,), 'maximum')
    array([5, 5, 1, 2, 3, 4, 5, 5, 5])
    
    >>> np.pad(a, (2,), 'mean')
    array([3, 3, 1, 2, 3, 4, 5, 3, 3])
    
    >>> np.pad(a, (2,), 'median')
    array([3, 3, 1, 2, 3, 4, 5, 3, 3])
    
    >>> a = [[1, 2], [3, 4]]
    >>> np.pad(a, ((3, 2), (2, 3)), 'minimum')
    array([[1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1],
           [3, 3, 3, 4, 3, 3, 3],
           [1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1]])
    
    >>> a = [1, 2, 3, 4, 5]
    >>> np.pad(a, (2, 3), 'reflect')
    array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2])
    
    >>> np.pad(a, (2, 3), 'reflect', reflect_type='odd')
    array([-1,  0,  1,  2,  3,  4,  5,  6,  7,  8])
    
    >>> np.pad(a, (2, 3), 'symmetric')
    array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3])
    
    >>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd')
    array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7])
    
    >>> np.pad(a, (2, 3), 'wrap')
    array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3])
    
    >>> def pad_with(vector, pad_width, iaxis, kwargs):
    ...     pad_value = kwargs.get('padder', 10)
    ...     vector[:pad_width[0]] = pad_value
    ...     vector[-pad_width[1]:] = pad_value
    >>> a = np.arange(6)
    >>> a = a.reshape((2, 3))
    >>> np.pad(a, 2, pad_with)
    array([[10, 10, 10, 10, 10, 10, 10],
           [10, 10, 10, 10, 10, 10, 10],
           [10, 10,  0,  1,  2, 10, 10],
           [10, 10,  3,  4,  5, 10, 10],
           [10, 10, 10, 10, 10, 10, 10],
           [10, 10, 10, 10, 10, 10, 10]])
    >>> np.pad(a, 2, pad_with, padder=100)
    array([[100, 100, 100, 100, 100, 100, 100],
           [100, 100, 100, 100, 100, 100, 100],
           [100, 100,   0,   1,   2, 100, 100],
           [100, 100,   3,   4,   5, 100, 100],
           [100, 100, 100, 100, 100, 100, 100],
           [100, 100, 100, 100, 100, 100, 100]])

None
(1, 5, 4)
[[0.275 0.437 0.958 0.833 0.339]
 [0.174 0.376 0.    0.253 0.81 ]
 [0.01  0.608 0.613 0.102 0.386]
 [0.032 0.907 1.    0.056 0.907]
 [0.586 0.756 0.64  0.591 0.015]]
[19 14  0 13 12 10  3  6]
[ 3 15 10 15  3  9 16 11]
[ 3 10]

11-得到昨天、今天、明天的

yes = np.datetime64('today', 'D') - np.timedelta64(1, 'D')
tod = np.datetime64('today', 'D')
tom = np.datetime64('today', 'D') + np.timedelta64(1, 'D')
print(f"昨天是{yes}")
print(f"今天是{tod}")
print(f"明天是{tom}")

12-得到一个月中所有的天

tt = np.arange('2022-08', '2022-09', dtype='datetime64[D]')
print(tt)

13-得到一个数的整数部分

xs = np.random.uniform(0, 20, 8)
print(xs)

print(np.floor(xs))

14-构造一个数组,让它不能被改变–只读

# zz = np.zeros(5)
# zz.flags.writeable = False
# zz[0] = 2
# print(zz[0])

15-打印大数据的部分值

np.set_printoptions(threshold=5)
bq = np.zeros((20, 20))
print(bq)

相关程序运行如下:

昨天是2022-08-29
今天是2022-08-30
明天是2022-08-31
['2022-08-01' '2022-08-02' '2022-08-03' '2022-08-04' '2022-08-05'
 '2022-08-06' '2022-08-07' '2022-08-08' '2022-08-09' '2022-08-10'
 '2022-08-11' '2022-08-12' '2022-08-13' '2022-08-14' '2022-08-15'
 '2022-08-16' '2022-08-17' '2022-08-18' '2022-08-19' '2022-08-20'
 '2022-08-21' '2022-08-22' '2022-08-23' '2022-08-24' '2022-08-25'
 '2022-08-26' '2022-08-27' '2022-08-28' '2022-08-29' '2022-08-30'
 '2022-08-31']
[16.229 12.806 12.496  2.91  11.404  1.302  6.268  4.341]
[16. 12. 12.  2. 11.  1.  6.  4.]
[[0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 ...
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]]


16-找到一个数组中,最接近一个数的索引

zd = np.arange(100)
vv = np.random.uniform(0, 100)
print(vv)

index = (np.abs(zd-vv)).argmin()
print(zd[index])

17-32位float类型和32位int类型转换

lx = np.arange(10, dtype=np.int32)
print(lx.dtype)
lx = lx.astype(np.float32)
print(lx.dtype)

18-打印数组元素位置坐标与数值

dy = np.arange(12).reshape(3, 4)
for i, val in np.ndenumerate(dy):
    print(i, val)

19-按照数组的某一列进行排序

px = np.random.randint(0, 10, (3, 3))
print(px)
print(px[px[:, 0].argsort()])

20-统计数组中每个数值出现的次数

cs = np.array([3, 5, 23, 5, 2, 5, 6, 7, 2, 3, 5])
print(np.bincount(cs))

相关程序运行如下:

52.69503887473037
53
int32
float32
(0, 0) 0
(0, 1) 1
(0, 2) 2
(0, 3) 3
(1, 0) 4
(1, 1) 5
(1, 2) 6
(1, 3) 7
(2, 0) 8
(2, 1) 9
(2, 2) 10
(2, 3) 11
[[6 0 7]
 [2 3 5]
 [4 2 4]]
[[2 3 5]
 [4 2 4]
 [6 0 7]]
[0 0 2 ... 0 0 1]


21-如何对一个四维数组的最后两维求和

szzz = np.random.randint(0, 10, [4, 4, 4, 4])
qh = szzz.sum(axis=(-2, -1))
print(qh)

22-交换矩阵中的两行

sz = np.arange(16).reshape(4, 4)
sz[[0, 1]] = sz[[1, 0]]
print(sz)

23-找到一个数组中最常出现的数字

sz = np.random.randint(0, 20, 20)
print(np.bincount(sz).argmax())

24-快速查找TOP K

sz = np.arange(1000)
np.random.shuffle(sz)
x = 66
print(sz[np.argpartition(-sz, x)[:x]])

25-去除掉一个数组中所有元素都相同的数据

np.set_printoptions(threshold=6)
sz = np.random.randint(0, 5, (10, 3))
print(sz)

sj = np.all(sz[:, 1:] == sz[:, :-1], axis=1)
print(sj)

sj2 = np.any(sz[:, 1:] == sz[:, :-1], axis=1)
print(sj2)

相关程序运行如下:

[[81 81 71 54]
 [78 60 38 63]
 [63 81 74 80]
 [67 58 69 76]]
[[ 4  5  6  7]
 [ 0  1  2  3]
 [ 8  9 10 11]
 [12 13 14 15]]
3
[982 977 979 ... 948 952 934]
[[4 3 3]
 [0 3 1]
 [1 4 1]
 ...
 [0 2 0]
 [0 0 1]
 [0 4 3]]
[False False False ... False False False]
[ True False False ... False  True False]

————————————————————————————————————————————————————————

怎么改变自己的形象

1、不要老是笑,特别是尴尬的赔笑

2、说话自然一点,不要油腔滑调,语气平和稳重,语速不紧不慢。

3、大大方方拒绝别人,理由简短。过多的解释反而让你称为错误的异方,记住,拒绝别人不是你的错。

4、不要主动帮助别人。如果别人没主动请求你,不要主动提供帮助。帮上了它不会感激,帮不上反而会成为背锅的一方。

5、不要拿自己的糗事逗别人开心,不要说贬低自己抬高别人的话。说话宁可保守也不要夸奖,否则也是适得其反,过犹不及。

6、和别人在一起时,让别人找话题,不要非把自己当成活跃气氛的那一个。

7、小动作不要太多,容易体现出自己的不自信,行为举止要正常放松。

8、不要做别人情绪的垃圾桶,别人向你抱怨时请保持安静。记住,你不用讨好任何一个人。

9、比起被人喜欢,你的尊严和你的原则更加重要。他们是你作为一个独立完整的人格的验证,不容侵犯。

10、学会拒绝,做好自己分内的事,责任分工要明确。


每日一言:

成年人最好的自律是及时止损,人都有执念,但不能执迷不悟!


持续更新中…

点赞,你的认可是我创作的动力
收藏,你的青睐是我努力的方向
评论,你的意见是我进步的财富
关注,你的喜欢是我长久的坚持

欢迎关注微信公众号程序人生6】,一起探讨学习哦!!!

有关【数模之数据分析-2】的更多相关文章

  1. ruby - 解析 RDFa、微数据等的最佳方式是什么,使用统一的模式/词汇(例如 schema.org)存储和显示信息 - 2

    我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i

  2. ruby - Ruby 有 `Pair` 数据类型吗? - 2

    有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳

  3. ruby - 我如何添加二进制数据来遏制 POST - 2

    我正在尝试使用Curbgem执行以下POST以解析云curl-XPOST\-H"X-Parse-Application-Id:PARSE_APP_ID"\-H"X-Parse-REST-API-Key:PARSE_API_KEY"\-H"Content-Type:image/jpeg"\--data-binary'@myPicture.jpg'\https://api.parse.com/1/files/pic.jpg用这个:curl=Curl::Easy.new("https://api.parse.com/1/files/lion.jpg")curl.multipart_form_

  4. 世界前沿3D开发引擎HOOPS全面讲解——集3D数据读取、3D图形渲染、3D数据发布于一体的全新3D应用开发工具 - 2

    无论您是想搭建桌面端、WEB端或者移动端APP应用,HOOPSPlatform组件都可以为您提供弹性的3D集成架构,同时,由工业领域3D技术专家组成的HOOPS技术团队也能为您提供技术支持服务。如果您的客户期望有一种在多个平台(桌面/WEB/APP,而且某些客户端是“瘦”客户端)快速、方便地将数据接入到3D应用系统的解决方案,并且当访问数据时,在各个平台上的性能和用户体验保持一致,HOOPSPlatform将帮助您完成。利用HOOPSPlatform,您可以开发在任何环境下的3D基础应用架构。HOOPSPlatform可以帮您打造3D创新型产品,HOOPSSDK包含的技术有:快速且准确的CAD

  5. FOHEART H1数据手套驱动Optitrack光学动捕双手运动(Unity3D) - 2

    本教程将在Unity3D中混合Optitrack与数据手套的数据流,在人体运动的基础上,添加双手手指部分的运动。双手手背的角度仍由Optitrack提供,数据手套提供双手手指的角度。 01  客户端软件分别安装MotiveBody与MotionVenus并校准人体与数据手套。MotiveBodyMotionVenus数据手套使用、校准流程参照:https://gitee.com/foheart_1/foheart-h1-data-summary.git02  数据转发打开MotiveBody软件的Streaming,开始向Unity3D广播数据;MotionVenus中设置->选项选择Unit

  6. 使用canal同步MySQL数据到ES - 2

    文章目录一、概述简介原理模块二、配置Mysql使用版本环境要求1.操作系统2.mysql要求三、配置canal-server离线下载在线下载上传解压修改配置单机配置集群配置分库分表配置1.修改全局配置2.实例配置垂直分库水平分库3.修改group-instance.xml4.启动监听四、配置canal-adapter1修改启动配置2配置映射文件3启动ES数据同步查询所有订阅同步数据同步开关启动4.验证五、配置canal-admin一、概述简介canal是Alibaba旗下的一款开源项目,Java开发。基于数据库增量日志解析,提供增量数据订阅&消费。Git地址:https://github.co

  7. ruby-on-rails - 创建 ruby​​ 数据库时惰性符号绑定(bind)失败 - 2

    我正在尝试在Rails上安装ruby​​,到目前为止一切都已安装,但是当我尝试使用rakedb:create创建数据库时,我收到一个奇怪的错误:dyld:lazysymbolbindingfailed:Symbolnotfound:_mysql_get_client_infoReferencedfrom:/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundleExpectedin:flatnamespacedyld:Symbolnotfound:_mysql_get_client_infoReferencedf

  8. STM32读取串口传感器数据(颗粒物传感器,主动上传) - 2

    文章目录1.开发板选择*用到的资源2.串口通信(个人理解)3.代码分析(注释比较详细)1.主函数2.串口1配置3.串口2配置以及中断函数4.注意问题5.源码链接1.开发板选择我用的是STM32F103RCT6的板子,不过代码大概在F103系列的板子上都可以运行,我试过在野火103的霸道板上也可以,主要看一下串口对应的引脚一不一样就行了,不一样的就更改一下。*用到的资源keil5软件这里用到了两个串口资源,采集数据一个,串口通信一个,板子对应引脚如下:串口1,TX:PA9,RX:PA10串口2,TX:PA2,RX:PA32.串口通信(个人理解)我就从串口采集传感器数据这个过程说一下我自己的理解,

  9. SPI接收数据异常问题总结 - 2

    SPI接收数据左移一位问题目录SPI接收数据左移一位问题一、问题描述二、问题分析三、探究原理四、经验总结最近在工作在学习调试SPI的过程中遇到一个问题——接收数据整体向左移了一位(1bit)。SPI数据收发是数据交换,因此接收数据时从第二个字节开始才是有效数据,也就是数据整体向右移一个字节(1byte)。请教前辈之后也没有得到解决,通过在网上查阅前人经验终于解决问题,所以写一个避坑经验总结。实际背景:MCU与一款芯片使用spi通信,MCU作为主机,芯片作为从机。这款芯片采用的是它规定的六线SPI,多了两根线:RDY和INT,这样从机就可以主动请求主机给主机发送数据了。一、问题描述根据从机芯片手

  10. 微信小程序通过字典表匹配对应数据 - 2

    前言一般来说,前端根据后台返回code码展示对应内容只需要在前台判断code值展示对应的内容即可,但要是匹配的code码比较多或者多个页面用到时,为了便于后期维护,后台就会使用字典表让前端匹配,下面我将在微信小程序中通过wxs的方法实现这个操作。为什么要使用wxs?{{method(a,b)}}可以看到,上述代码是一个调用方法传值的操作,在vue中很常见,多用于数据之间的转换,但由于微信小程序诸多限制的原因,你并不能优雅的这样操作,可能有人会说,为什么不用if判断实现呢?但是if判断的局限性在于如果存在数据量过大时,大量重复性操作和if判断会让你的代码显得异常冗余。wxswxs相当于是一个独立

随机推荐