Wikepedia:
Seven Prime Ministers have died in office .....
Spencer Compton, 1st Earl of Wilmington, who died on 2 July 1743.
Henry Pelham, who died on 6 March 1754.
Charles Watson-Wentworth, 2nd Marquess of Rockingham, who died on 1 July 1782.
William Pitt the Younger, who died on 23 January 1806.
Spencer Perceval, who was shot by John Bellingham on 11 May 1812.
George Canning, who died on 8 August 1827.
Henry Temple, 3rd Viscount Palmerston, who died on 18 October 1865.
Spencer Perceval is the only Prime Minister to be assassinated.