Think it depends on the type of fish. If it normally schools with other fish ie clown loach, I'd say yes. But if its a jardini and super territorial, I'd say no.
Fish only feel pain, fear, hunger, mating pleasure. I don't think fish get lonely that too much of an human emotion I'd think. Even schoolers would just feel scared of they were alone not lonely.
Got an enormous zebra tilapia that had to come out of the community tank due to being a nasty bastard. He's temporarily housed in a 30" tank but loves it!! He used to have sand now there's stones to play with! Spends all day dredging happily.