Equivalent functions in python as that in R
来源:互联网 发布:股票收益率数据 编辑:程序博客网 时间:2024/06/15 19:37
1. subsets on pandas.DataFrame
codes in python
@Haiyan Jiangimport numpy as npimport pandas as pdx = np.arange(0,80,2)df = pd.DataFrame(x.reshape(10,4), columns = list('abcd'))df.loc[1,'a']df.loc[1:3, ['a','b']]df.loc[[1,3,5], ['a','b']]df.iloc[0, 1]df.iloc[0:5, 1]df.iloc[0:5, 0:2]df.loc[:,'a']df.loc[:,['a']]df.loc[:,['a','b']]df.loc[0:5, ['a','b']]df.loc[:, ['a','b']]df.loc[0:5,:]df.iloc[:,0]df.iloc[:,0:1]df.iloc[0:5, 0:2]df.iloc[:,[1,2]]df.iloc[0:5,:]
2. combine as two columns of a dataframe similar to the cbind function in R
Codes in python
import pandas as pdtest1 = pd.DataFrame([1,3,5,7,9])test2 = pd.DataFrame([2,4,6,8,0])test3 = pd.concat([test1, test2], axis=1)test3.columns = ['a','b']
阅读全文
0 0
- Equivalent functions in python as that in R
- Python equivalent of which() in R
- Functions in R
- [Built-in Functions] - R
- functions setting in R
- python build-in functions
- Python Built-in Functions
- python build-in functions
- Python built-in functions
- Python -- Built in functions
- python :built-in functions
- Simple Python Built-in Functions
- Equivalent typeof in MC++
- From that guides,as early as in nine years ago
- python Built-in Functions(python内置函数)
- Functions that are executed before and after main() in C
- Cannot use __try in functions that require object unwinding
- Using closures as objects in R
- 【bzoj1854】[Scoi2010]游戏
- 网络中的ARP协议
- Linux Command Line and....ch13(更多的结构化命令——循环)
- 清空form表单
- v-show
- Equivalent functions in python as that in R
- 基于BootStrap与PHP相结合的带有搜索框的ajax无刷新分页案例(支持三种搜索)
- 【JVM】GC算法与垃圾收集器
- 排序之直接选择排序
- 去除select边框和三角-----appearance:none
- 反转链表
- 论文阅读(1)-
- UIAlertView中的textField输入文本过长时偏移
- mybatis学习之查询缓存