从pandas dataframe中删除unicode字符,表情符号,回车,结束行

bjp0bcyl  于 2023-09-29  发布在  其他
关注(0)|答案(1)|浏览(111)

我有一个Pandas Dataframe ,其中有Unicode字符,如\u2019\u2015\u2022结束行字符\n和回车\r和表情符号\ud83d\udd8b\ufe0f
我似乎无法移除它们
我试

data = '../data/data.csv'
df = pd.read_csv(data)
df['description'] = df['description'].str.encode('ascii', 'ignore').str.decode('ascii')

将它们应用于单个字符串可以工作,但不能应用于 Dataframe 。
也尝试了here的解决方案
似乎都不管用
下面是一个例子df:

,description
12203,"The new year started with the announcement of a new weight loss drug, poised to earn pharmaceutical companies billions once rubber-stamped. But quick fixes won\u2019t reverse long-term debilitating lifestyle and cultural issues. Currently, 19.7% of all children aged 2-19 are obese, with obesity rates climbing in 2-5, 6-11, and 12-19 year-olds. Into adulthood obesity prevalence in the U.S. is 41.9% of every adult! For Hispanic and black children the percentages are 26.2 and 24.8 respectively, while for Hispanic and black adults the percentages are far higher at 45.6 and 49.9 respectively. The prevalence is slightly lower for white children and adults, but substantially lower for Asian children and adults. Why? Culture, family, tradition, etc., all certainly contribute to the differences in double-digit percentages of obesity just as it does for incomes. When every symptom of sickness was reclassified in early 2020 under the same title, millions suffered from medical malpractice. While we are so eager to blame a particle or a treatment, we rarely take a deep look into common-sense causes of conditions, that although may not be entirely our fault, certainly can be dealt with in a much less reactive manner. After all, obesity partners with Type 2 diabetes, coronary heart disease, stroke, osteoarthritis, breathing problems, cancer, anxiety, depression, chronic inflammation, and an overall reduced quality of life - all the things blamed on SARS-CoV-2 and vaccines."
4299,"His older brother died in an accident, leaving behind a shy brother-in-law and a pair of twins. After five years in the army, Darel Kasali returned to his hometown of Cemara Village, a village known for its poor population. At first he was selling fried rice, suddenly he had an idea that could help the poor. Under his leadership, the villagers gradually achieved success."
9928,"Are you a parent struggling with anger issues? Do you find yourself losing control when dealing with your kids, leaving you filled with regret and guilt? Well, fear not, because on this episode of the Sean Donohue Show, we dive deep into the topic of parental anger management.\n\nhttps://www.parentingmodernteens.com\nhttps://www.tiktok.com/@the.family.coahttps://www.tiktok.com/@the.family.coach?_t=8ajFljMSuk6&_r=1ch?_t=8ajFljMSuk6&_r=1\nhttps://www.instagram.com/the.familycoach/\n\n\nhttp://www.bravepodcastnetwork.com\n\nCall the Podcast: To ask a parenting question to be featured on the podcast, leave a message for Sean at 916-365-2915"
5987,View our full collection of podcasts at our website:  https://www.solgoodmedia.com  or YouTube channel:  www.solgood.org/subscribe
12402,"Opperman Report \nRandy Fowler brother of Kevin Spacey describes his child hood abuse at the hands of his white supremacist father.\nLoretta Dillon expands on our first interview about the murder of Laci Peterson and the A&E TV mini series about Scott Peterson\n\n5 years ago #/, #:, #brother, #cold, #fowler, #guilty, #kevin, #laci, #murder, #of, #peterson, #randy, #scott, #spacey, #stone"
8986,"Episode produced and written by Marlena Storm. \n\nAFTER THE BELL is a segment in cooperation with HeelSection119 where co-host Marlena rips on topics that grate her as far as professional wrestling is concerned. \n\nThis Week's Topics: \n\n\u2022 \""What's Wrong With Predictable?\"" \n\u2022 Taking Wrestling Too Seriously.\n\u2022 \""Wrestling Is Fake\""\n\nSongs Featured:\n\u2022 Dolce Vita by The 69 Eyes\n\u2022 Wake Up by Shiraz Lane \n\u2022 Screaming For Adrenaline by Santa Cruz \n\nLINKS: \n\nhttps://www.spreaker.com/user/heelsection119 - HeelSection119's Page, this week's show is live now on demand! \nhttps://www.facebook.com/heelsection119 - Official Facebook Page\nhttps://my.roku.com/account/add?channel=HeelSection119 - HeelSection119's Roku channel\nhttps://youtu.be/VYvMOf3hsGA - \""Wrestling Isn't Wrestling\"" parody film by Max Landis."
2307,"Through step-by-step guidance and fascinating tales from her decades of experience, Sterling Moon teaches you how to develop your own spirit communication practice. She shows that everyone can connect with spirits\u2015you, too, can enrich your life, find peace, and make the world more fun and interesting through mediumship.This comprehensive book reveals how to identify and interact with many different types of spirits, including ancestors, deities, shadow people, and elementals. Sterling Moon provides journal prompts in every chapter as well as techniques for managing haunted people, places, and objects. You'll also explore a variety of communication tools such as scrying mirrors and ghost boxes. From ethical considerations to protection against negative entities, this book covers everything you need to build a safe and successful practice.\n\nSterling Moon has communicated with spirits since childhood and began officially practicing mediumship in 2016. She has been reading tarot since 1995 and teaching divination skills since 2013. She works with clients virtually and in-person at her private office in the metaphysical shop, Ritualcravt. She teaches through her school, Sterling Moon Divination Academy, and is a long-time instructor at Ritualcravt School. She also apprenticed under Johannes Bj\u00f6rn G\u00e5rdb\u00e4ck, an internationally respected teacher and spiritual worker in the Swedish folk magic tradition of trolldom. She lives in Colorado. Learn more about Sterling at https://sterlingmoontarot.com/."
6138,CES for short.\r\n\r\n\ud83d\udd8b\ufe0f The Author: https://www.reddit.com/user/Mr_Outlaw_/\r\n\ud83d\udcf9 Video!: https://www.youtube.com/watch?v=4BTbGavKdwc\r\n\ud83d\udcd6 Read Along!: https://www.reddit.com/r/nosleep/comments/l6he38/stories_from_the_cursed_excavation_site/\r\n\r\nCheck out my new books! A collection of Creepypasta compiled by some of my all time favorite authors and friends!\r\n\r\n\ud83d\udc80 Volume 1: http://a.co/iNqTwRZ\r\n\ud83d\udc80 Volume 2: http://a.co/i0O9zks\r\n\ud83d\udc80 Comic Book: http://a.co/2POGdNW\r\n\r\n\ud83e\uddca Chill with the Community!: https://www.thechillingapp.com/\r\n\r\nVisit the stores!\r\n\r\n\ud83c\udf75 Wife's Tea Shop: https://etsy.com/shop/IvoryMonocleTea\r\n\ud83d\udc55 Shirts & Stuff!: https://shop.spreadshirt.com/MrCreepyPasta/\r\n\ud83d\udcb0 Patreon (Only if you want to kids!): https://www.patreon.com/MrCreepyPasta
7197,Past Guest Seth comes back on to tell more of his encounters with the unknown and Melissa tell us about her happenings in Northern California.
10095,View our full collection of podcasts at our website:  https://www.solgoodmedia.com  or YouTube channel:  www.solgood.org/subscribe
14255,"\u00a0\n\nMinister Robinlynne Mabin\u00a0has been broadcastiing with the Spreaker Internet Radio Network since the summer of 2013. She has been recognized in 2014 by Spreaker for Best \u00a0Dj Presenter, Best Gospel of the Year Award and in 2015 Best DJ Award. She is a recent recipiant of\u00a0Three Internet Radio Star Awards from Positive Power 21 - Jerry Royce Live.\n\nOn Jan. 9\u00a0,2016 robinlynnesproductions.com \u00a0reached the 1Million listener milestone mark on Spreaker Radio. Her listening audiance has been provided an endless array of genres to incapsulate all who join the Vibes - Live listening family.\n\nwww.robinlynnesproductions.com\n\nTwitter - @robinlynnemabin.com\n\nPhone - 866 - 806 - 4680\n\nE - mail - [email protected]"
14256,"With reviews of new cinema releases Bastille Day starring Idris Elba, cyber horror Friends Request, Natalie Portman and Joel Edgerton in western drama Jane Got A Gun, Don Cheadle both stars and directs in Miles Davis biopic Miles Ahead, and small drama in Louder than Bombs.  In the home release section we take a look at comedy Sisters, drama with a hint of comedy in Joy, Christmas horror Krampus, epic drama Time Traveller and Keanu Reeves stars in thriller Exposed, plus as usual the latest box office/home release charts, movie news and our movies of the week."
14257,"Tracks from Hardwell, W&W, Kura, Seven Lions, Jetfire, Manse & Jakko.\nTracklist available at www.garrettgaudet.com\nFollow us on Twitter\n@GarrettGaudet https://twitter.com/GarrettGaudet\n@EDMWeekly https://twitter.com/EDMWeekly\nDemo \nNext Episode: April 7th (123)"
14258,Hey everyone! If we haven\u2019t seen you lately we miss you! We are back (both of us!) in a new\u2026 Read more We\u2019ve Moved: Workforce\u00a0Gaming
14259,"Happy Thursday! It\u2019s the Full Moon today,   and it could make you want to do some Spring Cleaning even though there\u2019s still some snow on the ground! If you love what you hear then take me wherever you go download my New Mobile App available on my website www.terrynazon.com \nBook your next consultation with me and Get Names, Dates, Times and Places! \u2122\nFollow me on Twitter @sexstrology,  and Instagram, \nLike me on my Facebook Fan page , \nSign up for my Free horoscope Newsletter!\nand get your free natal birth chart on my website to follow along with us! Bookmark me! And Add me to your favorites!  \nDownload the free iHeartshow Radio app on your mobile device and search for Terry Nazon, your astrological sun sign and if you know them your rising sign and Moon sign! Remember you are so much more than just a Sun sign; Let me make a prediction for you!"
14260,"Clothes Free Life presents the first episode of the Naked Soul Reflections series. \n\nIn this episode, we look at connection: how we are connected not only with ourselves, but with the world around us and the opportunity that gives us to live our lives as positive testaments to possibility."
14261,"Real estate heir Robert Durst, accused of killing at least three people over a 20-year span, was charged today with murder for the 2000 shooting death of his former confidant Susan Berman in her Benedict Canyon home.\u00a0The break in the case came from an HBO documentary called The Jinx: The Life and Deaths of Robert Durst."
14262,"Colorado Marijuana Shop tied to strip club and mayor as The Smokin Gun Apothecary opened on a site formerly occupied by the Denver area's best known strip club, Shotgun Willie's."
14263,RIGHT NOW Tinder Problems
14264,"Mobile Predictions and Key Mobile Trends in 2014 as Kim and Peggy speak with Andrew Budd, theglobal chair of theMobile Entertainment Forum(MEF) and theco-founder and executive chairman of mBlox."
yhuiod9q

yhuiod9q1#

您可以尝试(data.csv的内容是您从问题中摘录的片段):

df = pd.read_csv("data.csv", encoding="utf-8")

def replace(x):
    x = x.replace(r"\\", r"\\\\")
    return (
        x.encode("latin-1")
        .decode("unicode-escape")
        .replace("\r", "")
        .replace("\n", " ")
        .encode("ascii", "ignore")
        .decode("ascii")
    )

df["description"] = df["description"].apply(replace)

for d in df["description"]:
    print(d)
    print("-" * 80)

图纸:

The new year started with the announcement of a new weight loss drug, poised to earn pharmaceutical companies billions once rubber-stamped. But quick fixes wont reverse long-term debilitating lifestyle and cultural issues. Currently, 19.7% of all children aged 2-19 are obese, with obesity rates climbing in 2-5, 6-11, and 12-19 year-olds. Into adulthood obesity prevalence in the U.S. is 41.9% of every adult! For Hispanic and black children the percentages are 26.2 and 24.8 respectively, while for Hispanic and black adults the percentages are far higher at 45.6 and 49.9 respectively. The prevalence is slightly lower for white children and adults, but substantially lower for Asian children and adults. Why? Culture, family, tradition, etc., all certainly contribute to the differences in double-digit percentages of obesity just as it does for incomes. When every symptom of sickness was reclassified in early 2020 under the same title, millions suffered from medical malpractice. While we are so eager to blame a particle or a treatment, we rarely take a deep look into common-sense causes of conditions, that although may not be entirely our fault, certainly can be dealt with in a much less reactive manner. After all, obesity partners with Type 2 diabetes, coronary heart disease, stroke, osteoarthritis, breathing problems, cancer, anxiety, depression, chronic inflammation, and an overall reduced quality of life - all the things blamed on SARS-CoV-2 and vaccines.
--------------------------------------------------------------------------------
His older brother died in an accident, leaving behind a shy brother-in-law and a pair of twins. After five years in the army, Darel Kasali returned to his hometown of Cemara Village, a village known for its poor population. At first he was selling fried rice, suddenly he had an idea that could help the poor. Under his leadership, the villagers gradually achieved success.
--------------------------------------------------------------------------------
Are you a parent struggling with anger issues? Do you find yourself losing control when dealing with your kids, leaving you filled with regret and guilt? Well, fear not, because on this episode of the Sean Donohue Show, we dive deep into the topic of parental anger management.  https://www.parentingmodernteens.com https://www.tiktok.com/@the.family.coahttps://www.tiktok.com/@the.family.coach?_t=8ajFljMSuk6&_r=1ch?_t=8ajFljMSuk6&_r=1 https://www.instagram.com/the.familycoach/   http://www.bravepodcastnetwork.com  Call the Podcast: To ask a parenting question to be featured on the podcast, leave a message for Sean at 916-365-2915
--------------------------------------------------------------------------------
View our full collection of podcasts at our website:  https://www.solgoodmedia.com  or YouTube channel:  www.solgood.org/subscribe
--------------------------------------------------------------------------------
Opperman Report  Randy Fowler brother of Kevin Spacey describes his child hood abuse at the hands of his white supremacist father. Loretta Dillon expands on our first interview about the murder of Laci Peterson and the A&E TV mini series about Scott Peterson  5 years ago #/, #:, #brother, #cold, #fowler, #guilty, #kevin, #laci, #murder, #of, #peterson, #randy, #scott, #spacey, #stone
--------------------------------------------------------------------------------
Episode produced and written by Marlena Storm.   AFTER THE BELL is a segment in cooperation with HeelSection119 where co-host Marlena rips on topics that grate her as far as professional wrestling is concerned.   This Week's Topics:    "What's Wrong With Predictable?"   Taking Wrestling Too Seriously.  "Wrestling Is Fake"  Songs Featured:  Dolce Vita by The 69 Eyes  Wake Up by Shiraz Lane   Screaming For Adrenaline by Santa Cruz   LINKS:   https://www.spreaker.com/user/heelsection119 - HeelSection119's Page, this week's show is live now on demand!  https://www.facebook.com/heelsection119 - Official Facebook Page https://my.roku.com/account/add?channel=HeelSection119 - HeelSection119's Roku channel https://youtu.be/VYvMOf3hsGA - "Wrestling Isn't Wrestling" parody film by Max Landis.
--------------------------------------------------------------------------------
Through step-by-step guidance and fascinating tales from her decades of experience, Sterling Moon teaches you how to develop your own spirit communication practice. She shows that everyone can connect with spiritsyou, too, can enrich your life, find peace, and make the world more fun and interesting through mediumship.This comprehensive book reveals how to identify and interact with many different types of spirits, including ancestors, deities, shadow people, and elementals. Sterling Moon provides journal prompts in every chapter as well as techniques for managing haunted people, places, and objects. You'll also explore a variety of communication tools such as scrying mirrors and ghost boxes. From ethical considerations to protection against negative entities, this book covers everything you need to build a safe and successful practice.  Sterling Moon has communicated with spirits since childhood and began officially practicing mediumship in 2016. She has been reading tarot since 1995 and teaching divination skills since 2013. She works with clients virtually and in-person at her private office in the metaphysical shop, Ritualcravt. She teaches through her school, Sterling Moon Divination Academy, and is a long-time instructor at Ritualcravt School. She also apprenticed under Johannes Bjrn Grdbck, an internationally respected teacher and spiritual worker in the Swedish folk magic tradition of trolldom. She lives in Colorado. Learn more about Sterling at https://sterlingmoontarot.com/.
--------------------------------------------------------------------------------
CES for short.   The Author: https://www.reddit.com/user/Mr_Outlaw_/  Video!: https://www.youtube.com/watch?v=4BTbGavKdwc  Read Along!: https://www.reddit.com/r/nosleep/comments/l6he38/stories_from_the_cursed_excavation_site/  Check out my new books! A collection of Creepypasta compiled by some of my all time favorite authors and friends!   Volume 1: http://a.co/iNqTwRZ  Volume 2: http://a.co/i0O9zks  Comic Book: http://a.co/2POGdNW   Chill with the Community!: https://www.thechillingapp.com/  Visit the stores!   Wife's Tea Shop: https://etsy.com/shop/IvoryMonocleTea  Shirts & Stuff!: https://shop.spreadshirt.com/MrCreepyPasta/  Patreon (Only if you want to kids!): https://www.patreon.com/MrCreepyPasta
--------------------------------------------------------------------------------
Past Guest Seth comes back on to tell more of his encounters with the unknown and Melissa tell us about her happenings in Northern California.
--------------------------------------------------------------------------------
View our full collection of podcasts at our website:  https://www.solgoodmedia.com  or YouTube channel:  www.solgood.org/subscribe
--------------------------------------------------------------------------------
  Minister Robinlynne Mabinhas been broadcastiing with the Spreaker Internet Radio Network since the summer of 2013. She has been recognized in 2014 by Spreaker for Best Dj Presenter, Best Gospel of the Year Award and in 2015 Best DJ Award. She is a recent recipiant ofThree Internet Radio Star Awards from Positive Power 21 - Jerry Royce Live.  On Jan. 9,2016 robinlynnesproductions.com reached the 1Million listener milestone mark on Spreaker Radio. Her listening audiance has been provided an endless array of genres to incapsulate all who join the Vibes - Live listening family.  www.robinlynnesproductions.com  Twitter - @robinlynnemabin.com  Phone - 866 - 806 - 4680  E - mail - [email protected]
--------------------------------------------------------------------------------
With reviews of new cinema releases Bastille Day starring Idris Elba, cyber horror Friends Request, Natalie Portman and Joel Edgerton in western drama Jane Got A Gun, Don Cheadle both stars and directs in Miles Davis biopic Miles Ahead, and small drama in Louder than Bombs.  In the home release section we take a look at comedy Sisters, drama with a hint of comedy in Joy, Christmas horror Krampus, epic drama Time Traveller and Keanu Reeves stars in thriller Exposed, plus as usual the latest box office/home release charts, movie news and our movies of the week.
--------------------------------------------------------------------------------
Tracks from Hardwell, W&W, Kura, Seven Lions, Jetfire, Manse & Jakko. Tracklist available at www.garrettgaudet.com Follow us on Twitter @GarrettGaudet https://twitter.com/GarrettGaudet @EDMWeekly https://twitter.com/EDMWeekly Demo  Next Episode: April 7th (123)
--------------------------------------------------------------------------------
Hey everyone! If we havent seen you lately we miss you! We are back (both of us!) in a new Read more Weve Moved: WorkforceGaming
--------------------------------------------------------------------------------
Happy Thursday! Its the Full Moon today,   and it could make you want to do some Spring Cleaning even though theres still some snow on the ground! If you love what you hear then take me wherever you go download my New Mobile App available on my website www.terrynazon.com  Book your next consultation with me and Get Names, Dates, Times and Places!  Follow me on Twitter @sexstrology,  and Instagram,  Like me on my Facebook Fan page ,  Sign up for my Free horoscope Newsletter! and get your free natal birth chart on my website to follow along with us! Bookmark me! And Add me to your favorites!   Download the free iHeartshow Radio app on your mobile device and search for Terry Nazon, your astrological sun sign and if you know them your rising sign and Moon sign! Remember you are so much more than just a Sun sign; Let me make a prediction for you!
--------------------------------------------------------------------------------
Clothes Free Life presents the first episode of the Naked Soul Reflections series.   In this episode, we look at connection: how we are connected not only with ourselves, but with the world around us and the opportunity that gives us to live our lives as positive testaments to possibility.
--------------------------------------------------------------------------------
Real estate heir Robert Durst, accused of killing at least three people over a 20-year span, was charged today with murder for the 2000 shooting death of his former confidant Susan Berman in her Benedict Canyon home.The break in the case came from an HBO documentary called The Jinx: The Life and Deaths of Robert Durst.
--------------------------------------------------------------------------------
Colorado Marijuana Shop tied to strip club and mayor as The Smokin Gun Apothecary opened on a site formerly occupied by the Denver area's best known strip club, Shotgun Willie's.
--------------------------------------------------------------------------------
RIGHT NOW Tinder Problems
--------------------------------------------------------------------------------
Mobile Predictions and Key Mobile Trends in 2014 as Kim and Peggy speak with Andrew Budd, theglobal chair of theMobile Entertainment Forum(MEF) and theco-founder and executive chairman of mBlox.
--------------------------------------------------------------------------------

相关问题