Duckweed is good water filter as is any floating plant. It won't harm your fish, but it can grow quickly floating close to the light. A better plant for your tank would be Hornwort. It's fast growing, but the leaves are very thin and doesn't block the light very much and is more of a light filter. Your fish will appreciate this plant much more than Duckweed.
"Fear not, my young apprentice. Just change the tank water."