Wikipedia says all of City of Pittsburgh is in 18th, not 17th.
https://en.wikipedia.org/wiki/Pennsylvania%27s_17th_congressional_district
https://en.wikipedia.org/wiki/Pennsylvania%27s_18th_congressional_district
That used to be the case but not anymore.
Take a closer look at your link to the 17th. It says that it contains all parts of Allegheny County that are not in the 18th.
The 17th was gerrymandered to give the Dems an edge in that district.
Yes, the entire city of Pittsburgh is in the PA-18, but the liberal law professor hired by the Democrat Supreme Court of PA made sure to include as many liberal Pittsburgh suburbs in the PA-17 as possible. Lamb had won in a much more Republican district in a very low-turnout special election in 2017 (or maybe it was early 2018), and the judges made sure that his reelection would be essier. But no use crying over splilled milk; we have to support Parnell and send Lamb packing this November.