In this poem, the speaker, a poet, recalls wandering through nature by himself. He imagined himself as a cloud and found "others" in a crowd of daffodils. The daffodils are personified, as are other aspects of nature in this poem, and they provide company to the lonely wanderer/speaker. This is not a simple case of (pathetic fallacy) attributing human characteristics and feelings to inanimate objects. Wordsworth does use personification but only to show a cosmic connection between himself and the life and movements in nature.
In the first three stanzas, the speaker experiences these images in nature passively, as if the wind took him there (as a cloud). So, in the third stanza, he continues to perceive the daffodils and notes that the dancing daffodils are a more profound sight than the "sparkling waves." The speaker, a poet, was happy (gay) to be in such cheerful (jocund) company (the company of the daffodils). However, still experiencing these images passively, he doesn't fully appreciate what he is seeing:
I gazed--and gazed--but little thought
What wealth the show to me had brought:
In the fourth stanza, the poet remarks that he appreciates the daffodils even more in retrospect, in memory. When he is in a nostalgic/happy or melancholy mood (vacant or pensive), he recalls the "company" of the daffodils and this brings bliss to his solitude.