Update pandas data types // Change data types of multiple columns with Python pandas astype

Опубликовано: 20 Декабрь 2023
на канале: Kimberly Fessel
1,332
76

Change the data types of your Python pandas dataframes and series columns using pandas astype method. This video from my "Pandas Tips" series demonstrates how you can use Python pandas astype to recast your columns or dataframes from one data type into another. First, we change the current data types of our dataframe using the pandas dtypes property. I'll show you how to update the data types of your entire dataframe first, then we'll use astype to change each column value from an integer into a float. Level up your skills by leveraging the pandas astype mapper. This dictionary-like object allows you to submit the column name as the key and the data type you want as the value. Then you can change the data types of multiple columns at once with just one call to the astype method -- all by supplying a Python pandas mapper object. We do this to convert one column into floats and two others into Boolean data types. You can also make your astype changes permanent by overwriting your pandas dataframe, which we do at the end of the video. Check out this pandas tutorial video to improve your Python pandas knowledge and make the most out of the pandas astype method for changing the data types of your pandas objects!

0:00 Introduction
0:34 Set up and load data
1:09 .dtypes
1:29 Change entire dataframe
2:19 Change one column
3:31 Level UP! mapper
4:50 Multiple columns, different data types
6:33 Permanent changes
7:02 Conclusion & bloopers

💻 Github CODE 💻
https://github.com/kimfetti/Videos/bl...

🎥 Related VIDEOS 🎥
• pandas rename -    • Rename columns in pandas // Change th...  

📖 BOOKS about pandas from my Amazon Storefront 📖
• Pandas in Action: https://www.amazon.com/dp/1617297437?...
• Full List: https://www.amazon.com/shop/kimberlyf...

☕ Buy me a COFFEE ☕
If you have enjoyed the content presented in this video and are able, consider buying a virtual cup of coffee to keep my channel going!
https://www.buymeacoffee.com/kimberly...

#python #pandas #pythonprogramming


Смотрите видео Update pandas data types // Change data types of multiple columns with Python pandas astype онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Kimberly Fessel 20 Декабрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,332 раз и оно понравилось 76 людям.