Example Using Code

# EXamples

#Code Example
p1 <- "
##### PLACE PYTHON CODE BELOW
import pandas as pd
d = {'First' : [1., 2., 3.],'Second' : [1,2,3]}

AA = pd.DataFrame(d)
##### END PYTHON CODE
"

Example Running Individual Lines

pyExec(p1)
pyExecp('AA')
##    First  Second
## 0    1.0       1
## 1    2.0       2
## 2    3.0       3
pyExec('print("Hi")')
## Hi

Example Running an entire python script

pyExecfile("Test2.py")
##    First  Second
## 0    1.0       1
## 1    2.0       2
## 2    3.0       3
pyExecp('Test_string')
## 'Hello world'
#Note for markdown I must save the file in the python code and then call it from Markdown
alt text

alt text