Author Archives: Zhanshan Dong

Conversion of list of dictionary and dataframe in Python

In Python there is a dataframe package: pandas. The dataframe package simplifies a lot of things and it is comparable to a dataframe in R. Sometime you need convert a list of dictionary to a dataframe and vice versa. To … Continue reading

Share
Posted in Python | Tagged , , , | Leave a comment

Clustering in R

There is a nice post at https://stackoverflow.com/questions/15376075/cluster-analysis-in-r-determine-the-optimal-number-of-clusters that provide a number of examples to illustrate how to determine number of clusters. Below are two examples: # prepare data from a dataframe # var1 includes one group # var2 includes second group … Continue reading

Share
Posted in R, R/S-Plus | Tagged , , , , | Leave a comment

GET BLUE or BLUP from lmer in R

The following text is copied and pasted from https://stats.stackexchange.com/questions/122218/why-do-the-estimated-values-from-a-best-linear-unbiased-predictor-blup-differ. Q: Why do the estimated values from a Best Linear Unbiased Predictor (BLUP) differ from a Best Linear Unbiased Estimator (BLUE)? I understand that the difference between them is related to … Continue reading

Share
Posted in R, R/S-Plus | Tagged , , , , , , | Leave a comment

Use MySQL database in Python

PyMySQL its a pure python client library, you can install using pip install PyMySQL (find documentation at https://pymysql.readthedocs.io/en/latest/). The following is a simple example to demonstrate how to use the library. #!/usr/bin/env python from __future__ import print_function import pymysql conn … Continue reading

Share
Posted in MySQL, Python | Tagged , , | Leave a comment

Use python to create PowerPoint slides automatically

I have a large number of images. I want to organize them in powerpoint files by automatically insert each picture to a new powerpoint slide and control it’s position and size. I came across a nice Python library – python-pptx … Continue reading

Share
Posted in Python | Tagged , , , , | Leave a comment