Meet Barbara Gordon, librarian at the Gotham City Public Library by day, and crime-fightin' wonder Batgirl by night. Gordon was first introduced to the Batman comics and TV show in 1966, as an attempt to bring in female readers and viewers. While previous female characters (Batwoman and Bat-girl) were introduced in an attempt to dodge accusations of homosexuality between Batman and Robin, Batgirl wasn't there for romance as much as she was for ass-kicking. And did I mention that she was a librarian?
It's a Wonderful Life tells us a story about what it means to be a librarian. In this alternate reality, Mary is portrayed as a librarian in order to convey just how bad things got without George around. Mary is an old maid, and in 1946, "old maid" was synonymous with "librarian".
This character certainly reflects societal beliefs about librarians in 1946: that librarians were single, unhappy women. Librarian identity in film has become a bit more complex since then, but Mary's character is still all too familiar.