In this post, we will explore equivalents of data types between the two popular languages of data science: R and Python.
Despite the fact that R has traditionally been the language favored by statisticians for data analaysis, Python has emerged as a serious contender in the last few years. Being a flexible, general-purpose programming language, Python has drawn attention from the community especially with the development of two particular packages, Numpy and Pandas. These packages offer support for the R-like data types, a list of which you can see below:
R | Python |
vector | numpy.array |
matrix/array | numpy.matrix |
dataframe | pandas.DataFrame, pandas.Series (single column) |
list | list |
factor | pandas.DataFrame (with dtype category) |