Christian Siauwijaya
  • Home
  • Research
  • Blog
  • CV

Sample post: Python and Stata side by side

python
stata
methods
A placeholder post that shows how code, output and highlighting look on this site.
Published

November 18, 2026

This is a sample post. Delete this folder once the first real post is up.

Python

import pandas as pd

# Quarterly real GDP growth, year on year (%)
gdp = pd.Series(
    [5.0, 5.1, 4.9, 5.0, 5.1],
    index=pd.period_range("2025Q1", periods=5, freq="Q"),
    name="gdp_yoy",
)
print(gdp.rolling(2).mean().round(2))

Stata

* Local projection of credit growth on a policy-rate shock
use "data/macro_panel.dta", clear
xtset country quarter

forvalues h = 0/8 {
    quietly reghdfe F`h'.credit_growth rate_shock L(1/4).credit_growth, ///
        absorb(country quarter) vce(cluster country)
    display "h = `h': " %6.3f _b[rate_shock]
}

Code blocks are shown, not run, so the deploy server never needs Python or Stata. To run Python and publish its output, change a block’s fence to {python} and render locally; freeze: auto stores the result.

 

© 2026 Christian Siauwijaya