python将list转为tuple
来源:互联网 发布:微星显卡保修几年 淘宝 编辑:程序博客网 时间:2024/05/01 18:44
此博客提供一种将list转为tuple,并提取相应的矩阵的方法,代码如下:
dates = pd.date_range('20130101', periods=6)df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))print dftf=tuple(df.values)m=np.random.randn(6,4)for index,i in enumerate(tf): m[index]=iprint m[:2,:-1]
运行结果:
A B C D
2013-01-01 -0.141409 -0.730154 1.575341 1.574466
2013-01-02 1.467078 0.407789 0.037842 0.121589
2013-01-03 -0.584768 1.303740 0.582591 0.798636
2013-01-04 -1.270843 0.251929 0.375151 -1.338465
2013-01-05 0.158676 -1.539456 -0.329063 -0.149361
2013-01-06 -0.732903 1.272572 -0.340342 0.414401
[[-0.141409 -0.73015353 1.57534091]
[ 1.46707818 0.40778942 0.03784234]]
阅读全文
0 0
- python将list转为tuple
- python将list转为matrix
- Python list and tuple
- 【python】-list,tuple,dict
- <python>string,list,tuple
- python immutable tuple list
- Python:list,tuple,dict
- [Python]list, tuple,dict
- Python-List&Tuple学习
- python list and tuple
- [Python]List,Tuple,循环
- Python list和tuple
- Python list和tuple
- Python list, tuple
- Python----list,dict,tuple
- python的list tuple
- python list tuple
- 将ResultSet转为List
- MySQL理解索引、添加索引的原则
- Spring 集成 Jedis
- 6:ZigZag Conversion(锯齿形的转换)
- java的键盘录入
- nginx安装
- python将list转为tuple
- 信号的频率谱与功率谱的区别
- poj1151 Atlantis(线段树+扫描线+离散化,求矩形面积并)
- servlet之文件上传
- Codeforces 863C 模拟
- 纳兰词赏析
- Spring data jpa + postgresql 项目中使用Lucene的简单介绍
- [BZOJ2064]分裂(状压dp)
- 第三方登录之支付宝