Mash the sweet potato (or blend in a food processor) to make a smooth puree; stir in the brown sugar, lemon extract, cinnamon and nutmeg. Measure 1/3 cup plus 2tablespoons puree for the cookie batter; reserve the rest (about 1/2 cup) for the frosting.
For the cookies, mix the butter with the brown and granulated sugars together in a large bowl until creamy. Add the 1/3 cup plus 2 tablespoons sweet potato puree, eggs, and vanilla and lemon extracts; mix to blend.
Mix the flour together with the baking soda in a separate bowl. Slowly beat flour and baking soda mixture into the batter until well mixed.
Heat the oven to 325 degrees. Scoop cookies, using small cookie scoop, onto parchment paper-lined baking sheets. Bake for 8-10 minutes per batch.
For the frosting, mix the remaining sweet potato puree (about 1/2 cup) with 4-5cups powdered sugar, just until mixture is slightly firm. Add more powdered sugar if needed. Mix in vanilla and butter.
Spoon frosting into a pastry bag or plastic food bag fitted with a star tip. Pipe the frosting onto the cooled cookies in a decorative swirl using a number 1tip. Top cookies with ground pistachios.