In this paper, Apriori algorithm has been improved and applied to substation data mining process. Ant colony algorithm is applied to get the optimal solution of reactive power allocation in substations. The state transition probability formula is amended and parameters are dynamically adjusted in this ant colony algorithm. The choice of the ant's path to the next node is determined by the tabu table formulated according to the confidence level of the data mining. The switching strategy of the capacitor sets are given by online algorithm.