Oscillating flows past a cylindrical pellet with endplates are simulated by the three dimensional (3D) direct numerical simulation (DNS) method. Partial sums of the Fourier series is applied to analyze the harmonic velocity fields obtained by the DNS method. The 3D secondary streaming (SS) and the gap averaged SS are visualized by streak lines. The results show that the gap averaged SS patterns are eight closed two dimensional (2D) recirculations. However, the SS flows are 3D spirals. The present 3D SS patterns are compared favorably with previous experimental study. For 3D patterns, fluid particles near the endplates are attracted into the spirals toward the mid-plane and the two endplates. Various governing parameters such as aspect ratio, Keulegan-Carpenter number, and Stokes number are investigated. The thickness of inner layer of the recirculations of the 2D gap averaged SS and the size of the 3D SS spirals near the cylinder wall decrease with the gap distance, the Keulegan-Carpenter number, and the Stokes number due to thinner viscous layers. The 3D spiral numbers increase with Stokes number due to turbulence effects.