lL

In [3]: import numpy as np                                                      

In [4]: np.random.randint(0, 3, 9)                                              
Out[4]: array([2, 0, 1, 2, 0, 0, 0, 2, 1])

In [5]: np.random.randint(0, 3, 19)                                             
Out[5]: array([1, 1, 2, 1, 2, 2, 0, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0])

In [6]: np.random.randint(0, 4, 19)                                             
Out[6]: array([0, 1, 2, 0, 1, 3, 3, 2, 1, 0, 0, 3, 3, 3, 2, 0, 2, 1, 3])

In [7]: a  = np.random.randint(0, 4, 19)                                        

In [8]: for i in a: 
   ...:     print('{}\n'.format(i)) 
   ...:                                                                         
0

1



In [9]: b = a.tolist()                                                          

In [10]: b                                                                      
Out[10]: [0, 1, 3, 0, 0, 3, 0, 3, 3, 0, 2, 2, 0, 3, 2, 2, 0, 3, 3]

In [11]: import pandas aspd                                                     
  File "<ipython-input-11-9a9454fa6ae3>", line 1
    import pandas aspd
                     ^
SyntaxError: invalid syntax


In [12]: import pandas as pd                                                    

In [13]: c = pd.DataFrame(a, head=None)                                         
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-666d02a771ee> in <module>
----> 1 c = pd.DataFrame(a, head=None)

TypeError: __init__() got an unexpected keyword argument 'head'

In [14]: c = pd.DataFrame(a)                                                    

In [15]: c                                                                      
Out[15]: 
    0
0   0
1   1
2   3
3   0
4   0
5   3
6   0
7   3
8   3
9   0
10  2
11  2
12  0
13  3
14  2
15  2
16  0
17  3
18  3

In [16]: 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值