Supporting Statistical Analysis for Research
2.1 Data frames
Create a data frame with three observations of two variables. Name the variables
x1andx2. Make up numbers for the values of the observed variables.Set RStudio to python mode
library(reticulate) repl_python()import pandas as pdmy_data = ( pd.DataFrame(data={ 'x1': [1, 2, 3], 'x2': ["c", "b", "a"]}))Using any of the functions/methods from the discourse, display the number of observations and variables of the data frame.
print(my_data.shape)(3, 2)Or
print(my_data.head())x1 x2 0 1 c 1 2 b 2 3 a