President Barack Obama’s job-approval rating has risen over the past two months. I think I know the reason why — and North Carolina politicians should take note of it.

First the numbers. If you look at the historical data from polling aggregators like RealClearPolitics.com, you will see that the public has, on average, been more likely to disapprove of the president’s job performance than to approve of it since mid-2013.

During 2014, Obama’s disapproval ratings were typically between seven and 10 points above his approval ratings. During 2015, these averages got a little closer together — as the national economy continued its lengthy, although anemic, recovery and some voters became disenchanted with the newly Republican Senate — but Obama was still underwater. His disapproval ratings averaged just above 50 percent. His approval ratings were in the mid-40s.

This all began to change in early 2016. By February 1, the president’s disapproval averaged 49 percent, just two points higher than his approval. By March 10, Obama was more approved (49 percent) than disapproved (47 percent).

What changed? There’s no indication that the economy took a sudden upward surge. International affairs are at least a messy as before, with new terrorist incidents in Europe and continued disorder in the Middle East. The president’s signature program, the Affordable Care Act, attracted another round of bad publicity for rising costs and underwhelming enrollment.

I don’t think President Obama did anything to improve his public image. Rather, I think he is the beneficiary of a disastrous set of Democratic and Republican presidential contests that have dismayed and appalled many voters.

The two frontrunners, Hillary Clinton and Donald Trump, are among the least-liked politicians in modern American politics. Large majorities of voters — across regions, party affiliations, and most other demographic categories — have unfavorable views of their trustworthiness and character. Most voters think Clinton, at least, has relevant experience, which is why she thumps Trump in virtually all head-to-head polls and is heavily favored in the fall. But most Americans are disappointed in the choices before them, and rightly so.

Which is why, I believe, President Obama’s approval ratings are on a bit of an upswing. By comparison, he looks like a leader. He is not constantly trying to explain away his reckless and possibly illegal handling of classified material (Clinton) or acting like a disgusting, sexist bully (Trump).

As North Carolina politicians prepare to face the voters this fall, they should draw an important lesson from these recent political developments on the national stage. Swing voters — those whose changing opinions tend to explain fluctuations in poll numbers and electoral outcomes in close races — aren’t just interested in what your views are on particular issues. They are hungry for real leadership.

They are tired of reading, hearing, or watching news about politics that makes them wince, shudder, or shake their heads in embarrassment. Even if they don’t agree with you on lots of issues, they will think well of you and perhaps even vote for you if you act like a decent human being, like the helpful neighbor they respect rather than the obnoxious neighbor down the street they just try to avoid.

That means treating others with civility, including those with whom you disagree. That means offering simple, coherent explanations of your votes or positions that show why you think they will make people better off. That means having principles and sticking to them, rather than looking shifty, cowardly, or cynical.

If you look at poll questions other than presidential approval, you’ll see that the public hasn’t changed its opinion much about the underlying issues. It still disapproves of Obamacare, the president’s handling of foreign policy and the economy, and the general direction of the country. Americans haven’t suddenly become leftists. But some have looked at the presidential race, recoiled in horror, and concluded that President Obama isn’t as bad as they once thought.

They might not mind if he moved into the neighborhood. If the Clintons or the Trumps did, they’d go see a Realtor.

John Locke Foundation chairman John Hood is the author of Catalyst: Jim Martin and the Rise of North Carolina Republicans.