Frederick Pirani was born in Melbourne, Australia, on 3 December 1858. He was the son of Henry Cohen Pirani, a merchant, and his wife, Louisa Levy. The family moved to Hokitika, New Zealand, in 1864. Henry Pirani worked on the staff of a Fenian newspaper there; then in the early 1870s the family moved to Hawke's Bay where he continued to work as a printer and journalist, eventually becoming sub-editor of the Hawke's Bay Herald. Frederick followed in his father's footsteps, becoming an apprentice printer at the Wanganui Herald in the late 1870s. He was later a journalist. On 23 May 1879 at Napier he married Martha Berry. Within a few years Frederick returned to the South Island with his wife and young family, and in 1883 became a member of the Blenheim School Committee. This was the start of his public career and a long involvement with education in New Zealand.
Pirani moved in 1884 to Palmerston North where, in the next two decades, he held many local offices. He was elected chairman of the Palmerston School Committee in the 1880s, and was a long-serving member of the Wanganui Education Board from 1895. That year he was appointed to the Middle District of New Zealand University College Council, which was charged with governing a proposed university college at Wellington, and in 1903 he became a member of the Palmerston North High School board of governors. His interests were not confined to education: he was a borough councillor (1888–91 and 1901–3), member of the Wellington Land Board (1893–96), president of the Manawatu and West Coast Agricultural and Pastoral Association in 1897, and at one time chairman of the Palmerston North Licensing Committee. In 1891 he and his brother David purchased the Manawatu Standard. Frederick's wife, Martha Pirani, wrote editorials for the newspaper.
Pirani stood for the seat of Palmerston in the 1890 general election as candidate for the Knights of Labor, whose local assembly he had founded. He lost by 61 votes, but gained the seat in the 1893 election after Premier Richard Seddon named him as the government candidate. Pirani was a very active member of the House. He spoke frequently, often questioning ministers about education issues and the provision of services for Manawatu. He opposed the introduction of religious education into schools and sought an elective central education authority, clashing with the inspector general of schools, George Hogben, on these issues. He also came into conflict with Seddon, largely it seems because he considered the premier autocratic, but also because of ideological differences.
As a left-wing Liberal parliamentarian, Pirani was involved in an attempt to set up a breakaway radical party before the 1896 election. The attempt failed, possibly because Pirani insisted on being the leader. A small man, he was described as 'terrier-like' and may have inspired fear rather than confidence in his colleagues. Apparently fearless himself, in 1898 Pirani supported an opposition vote of no-confidence in the Liberal government.
Seddon became openly hostile to Pirani, and once referred to him in Parliament as a 'moodlewort' – a Lancashire dialect term for a mole – because he was always burrowing and was blind to everything but his own interests. In 1899 Seddon emphasised his opposition to Pirani by endorsing W. T. Wood as the government candidate for Palmerston. Pirani contested the Hutt seat in 1902, but came second to T. M. Wilford.
In 1903 Pirani moved to Petone, where he owned a newspaper called the Hutt and Petone Chronicle. He contested the Palmerston seat in 1905 as an independent but was defeated by 480 votes. He then became an estate agent before moving to Feilding in 1906 and purchasing the Feilding Star. He continued an earlier involvement with athletics and the fire brigade, and in 1912 served on a commission which inquired into a wide range of educational issues. During the First World War he went to the Western Front with a press delegation. He unsuccessfully contested the Wanganui seat in 1914 and the Wellington Central seat in 1919. By this time his political views were out of style.
Pirani lived in Wellington for the last years of his life and was chairman of the Kelburn School Committee. Frederick and Martha Pirani were divorced in July 1922, and Frederick married Iris Helen Doer (née Voght), who was also recently divorced, at Wellington on 27 September that year. Pirani was elected to the Wellington Education Board shortly before his death on 26 October 1926. He was survived by his second wife, two daughters and two sons of his first marriage, and a son of his second marriage.