0% found this document useful (0 votes)
19 views2 pages

Python vs R Functions Comparison

R and Python have similar functions for common data science tasks like importing and working with data frames. In R, packages are installed with install.packages() and loaded with library(), while in Python packages use pip install and are imported. Both languages can read CSV files, get/set the working directory, check the data type, and obtain a data frame's dimensions, column names, and summary statistics. R uses functions like rownames(), colnames(), and dim() while Python uses attributes like df.index, df.columns, and df.shape.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Python vs R Functions Comparison

R and Python have similar functions for common data science tasks like importing and working with data frames. In R, packages are installed with install.packages() and loaded with library(), while in Python packages use pip install and are imported. Both languages can read CSV files, get/set the working directory, check the data type, and obtain a data frame's dimensions, column names, and summary statistics. R uses functions like rownames(), colnames(), and dim() while Python uses attributes like df.index, df.columns, and df.shape.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd

R functions Python functions

1 class() type()
2 [Link]("PN") pip install PN
3 library(name) import pandas as pd
4 getwd() [Link]()
5 setwd() [Link]("dir path")
6 [Link]("files name") pandas.read_csv("file name")
7 c(1,2,4) vectors [1,2,4] (list)
8 rownames(df) [Link]
9 colnames(df) [Link]
10 dim(df) [Link]
11 length(df) len(df)
12 [Link](df) [Link](varible)
13 summary(df) [Link]()
14 str(df) [Link]()
15 df[ , ] [Link][ , ]
Operation
Gives data type of the mentioned variable
install the package
load a package
to get the current working dir
Change/set the current Working dir
Reads a csv table

names of rows
col names
number of rows and col

To convert into data frame


summary
structure

You might also like