Remember that Facebook is the largest employer in Menlo Park by a factor of about 10, which will totally skew those rankings.
Edit:
to be more clear, I'm making two points. Firstly, Facebook is not known for the sort of Tata/Infosys style abusive H1b (and there'll be almost none of them in Menlo Park) whilst SF is much larger, and there could easily be such a company with an office in SF.
Furthermore, the bar for entry to work as an engineer at Facebook is possibly higher than in SF as a whole.
Edit: to be more clear, I'm making two points. Firstly, Facebook is not known for the sort of Tata/Infosys style abusive H1b (and there'll be almost none of them in Menlo Park) whilst SF is much larger, and there could easily be such a company with an office in SF.
Furthermore, the bar for entry to work as an engineer at Facebook is possibly higher than in SF as a whole.