The authors report electrical transport properties of p-n junction based on semiconducting single-walled carbon nanotubes (SWCNTs). The formation of p-n junction is realized in SWCNTs, which are encapsulated with Fe nanoparticles at low filling fractions. The devices exhibit an excellent rectifying behavior, and no current down to 10-14 A level flows when the device is biased in reverse. During measurements performed in the temperature range from 10 to 300 K, the devices maintain high reproducibility. More importantly, even after exposure to air, the rectifying characteristic keeps stable, which strongly suggests that ideal p-n junction diodes can be fabricated by SWCNTs.