[SPARK-40010][PYTHON][DOCS] Make pyspark.sql.window examples self-contained
[SPARK-40010][PYTHON][DOCS] Make pyspark.sql.window examples self-contained

### What changes were proposed in this pull request?

This PR proposes to improve the examples in `pyspark.sql.window` by making each example self-contained with a brief explanation and a bit more realistic example.

### Why are the changes needed?

To make the documentation more readable and able to copy and paste directly in PySpark shell.

### Does this PR introduce _any_ user-facing change?

Yes, it changes the documentation

### How was this patch tested?

Manually ran each doctest.

Closes #37450 from dcoliversun/SPARK-40010.

Authored-by: Qian.Sun <fc1eee9d36d11f1f3cae41c2f5fa69db42b12cd8@gmail.com>
Signed-off-by: Hyukjin Kwon <2680965ad5aae29275c8fb10150cb10f5554e78b@apache.org>

WeichenXu123/spark,HyukjinKwon/spark,apache/spark,witgo/spark,hvanhovell/spark,witgo/spark,vinodkc/spark,zzcclp/spark,WeichenXu123/spark,vinodkc/spark,mahak/spark,apache/spark,wangyum/spark,gengliangwang/spark,witgo/spark,mahak/spark,zero323/spark,gengliangwang/spark,zzcclp/spark,zero323/spark,dongjoon-hyun/spark,shaneknapp/spark,wangyum/spark,witgo/spark,shaneknapp/spark,ueshin/apache-spark,srowen/spark,zzcclp/spark,hvanhovell/spark,srowen/spark,witgo/spark,holdenk/spark,gengliangwang/spark,wangyum/spark,srowen/spark,HyukjinKwon/spark,WeichenXu123/spark,ueshin/apache-spark,ueshin/apache-spark,mahak/spark,holdenk/spark,apache/spark,holdenk/spark,zero323/spark,ueshin/apache-spark,mahak/spark,dongjoon-hyun/spark,apache/spark,holdenk/spark,ueshin/apache-spark,zero323/spark,WeichenXu123/spark,shaneknapp/spark,holdenk/spark,ueshin/apache-spark,srowen/spark,mahak/spark,hvanhovell/spark,dongjoon-hyun/spark,gengliangwang/spark,WeichenXu123/spark,vinodkc/spark,gengliangwang/spark,ueshin/apache-spark,shaneknapp/spark,HyukjinKwon/spark,vinodkc/spark,holdenk/spark,zzcclp/spark,srowen/spark,WeichenXu123/spark,shaneknapp/spark,WeichenXu123/spark,dongjoon-hyun/spark,apache/spark,hvanhovell/spark,apache/spark,wangyum/spark,zero323/spark,dongjoon-hyun/spark,dongjoon-hyun/spark,hvanhovell/spark,vinodkc/spark,wangyum/spark,HyukjinKwon/spark,holdenk/spark,shaneknapp/spark,wangyum/spark,HyukjinKwon/spark,witgo/spark,zzcclp/spark,zero323/spark,gengliangwang/spark,vinodkc/spark,dongjoon-hyun/spark,zero323/spark,wangyum/spark,srowen/spark,mahak/spark,witgo/spark,zzcclp/spark,hvanhovell/spark,HyukjinKwon/spark,hvanhovell/spark,mahak/spark,gengliangwang/spark,apache/spark,vinodkc/spark,srowen/spark,shaneknapp/spark,HyukjinKwon/spark,zzcclp/spark