Feeling optimistic? You've got company.

More than two-thirds of Philadelphians recently surveyed said they expect the city to improve over the next five years, while fewer than one in five see worse times ahead.

More young people say they plan to stay.

In fact, the historically cantankerous denizens of the nation's fifth-most-populous city now report feeling more positive than at any time in the last six years, according to a poll by the Pew Charitable Trusts, which has asked the same question about residents' outlook since 2009.

Pew found that nearly half - 48 percent of respondents - feel the city is on the right track right now, while 33 percent have an opposite opinion.

That's the highest positive rating since the poll began.

"We know Philadelphians are more optimistic, but we didn't ask why," said Larry Eichel, director of Pew's Philadelphia Research Initiative. "Getting people to dissect their feelings is sometimes difficult in a poll."

Certainly, there are reasons to feel upbeat:

The coming visit of Pope Francis this September. The Democratic National Convention that will be here one summer hence. A city population that after decades of decline, has grown every year since 2007. New parks. New restaurants. New investment in Market East. Four proposals to pour $15 million into restoring and remaking iconic LOVE Park in Center City.

And yet the survey hinted at ongoing disparities - that Philadelphia's cash-strapped public schools are a desperate challenge, as are crime and decay in certain parts of the city. Black Philadelphians don't share whites' confidence in the fairness of the police.

For tale-of-two-cities skeptics who think measurements of positivity are really all about neighborhood and affluence, consider this breakdown of the poll's numbers:

Citywide, 48 percent of respondents said the city is on the right track. In South Philadelphia, it was 53 percent. West Philadelphia, 44 percent. North Philadelphia, 48 percent. Northwest Philadelphia, 53 percent. And Northeast Philadelphia, 43 percent.

"Any which way that you slice it," Eichel said, "more people in almost any subgroup were saying the city is headed in the right direction and is not off on the wrong track."

Income differences showed greater variations.

For people with household income less than $30,000, 45 percent said the city is on the right track. For incomes of $30,000 to $50,000, it was 52 percent. Incomes over $100,000, 61 percent.

The right-track/wrong-track balance tended to be more evenly split - that is, fewer people felt positively - in the subgroups of African American men under 40, African American women of all ages, and people with children under 18 at home. Although these subgroups generally said the city is on the right track, they did so by smaller margins.

Rating Philadelphia as a place to live, 70 percent of respondents said they would recommend it to a friend as a place to live and 24 percent said they would not.

Another positive indicator for the city's future: Young adults, ages 18 to 34, are sticking with Philadelphia. In 2013, the last time the question was asked, 49 percent said they would probably not be living in the city in five or 10 years; this year it just 39 percent said that.

Other findings:

Mayor Nutter approaches the end of his eight-year tenure with a 52 percent job-approval rating, with 37 percent disapproving. City Council fared worse - 40 percent approval, 42 percent disapproval.

Nearly half of Philadelphians have no opinion on whether to sell the Philadelphia Gas Works, while those who have a viewpoint reject a sale by a 2-1 ratio.

Residents support the city's decision last year to decriminalize the possession of small amounts of marijuana by a 2-1 ratio.

Fifty-five percent said they have "a great deal" or "a fair amount" of confidence in the city's police officers to treat black and white citizens equally; 42 percent said they had "just some" or "very little" confidence.

Two-thirds of whites expressed confidence - but fewer than half of black respondents did so.

Pew's citywide, random-sample survey of 1,603 landline and cellphone users, age 18 and older, was conducted via live interviews last month and on a few days in January. The final sample was weighted to reflect the city's demographic breakdown. The overall margin of error is plus or minus 2.5 percentage points.

215-854-2541 @MichaelMatza1

Inquirer staff writer Joseph Gambardello contributed to this article.