|
Hi Reader, In case you missed it, I launched a free, 7-hour pandas course! 800+ students have enrolled, and a few have already earned their certificate of completion 👩🎓 🔗 Link of the weekLooking for an internship in Data Science or Analytics? This site curates the latest internship postings and emails them to you each week! 👉 Tip #40: Build a DataFrame from multiple filesLet’s say that your dataset is spread across multiple files, but you want to read the dataset into a single pandas DataFrame. For example, I have a tiny dataset of stock market data in which each CSV file only includes a single day. Here’s the first day: Here’s the second day: And here’s the third day: You could read each CSV file into its own DataFrame, combine them together, and then delete the original DataFrames, but that would be memory inefficient and require a lot of code. A better solution is to use Python’s built-in glob module: You can pass a pattern to the In this case, glob returns filenames in an arbitrary order, which is why we sorted the list using Python’s built-in We can then use a generator expression to read each of the files using Unfortunately, there are now duplicate values in the index. To avoid that, we can tell the Pretty cool, right? Need to build a DataFrame column-wise instead? Use the same code as above, except pass axis='columns' to 👋 Until next timeDid you like this week’s tip? Please forward it to a friend or share this link in your favorite Slack team. It really helps me out! 🙌 See you next Tuesday! - Kevin P.S. Would you wear pajamas during a Zoom call? Did someone AWESOME forward you this email? Sign up here to receive Data Science tips every week! |
Join 25,000+ intelligent readers and receive AI tips every Tuesday!
Hi Reader, happy new year! 🎉 I wanted to share with you the three most important articles I found that look back at AI progress in 2025 and look forward at what is coming in 2026 and beyond. I’ve extracted the key points from each article, but if you have the time and interest, I’d encourage you to read the full articles! 💠 The Shape of AI: Jaggedness, Bottlenecks and Salients By Ethan Mollick “Jaggedness” describes the uneven abilities of AI: It’s superhuman in some areas and far below human...
Hi Reader, I just published a new YouTube video: How to use top AI models on a budget Description: Want to chat with the best AI models from OpenAI, Claude, and Google without paying $20/month? I'll show you how to use API keys with TypingMind to access top models for a fraction of the cost, demonstrate its killer feature of chatting with multiple models side-by-side, and explain when paying for a subscription is actually the smarter choice. Timestamps: 0:00 Introduction 0:37 Pay-per-token...
Hi Reader, On Friday, I announced my forthcoming book, Master Machine Learning with scikit-learn. In response, my Dad asked me: How does the subject of this book relate to Artificial Intelligence? In other words: What's the difference between AI and Machine Learning? Ponder that question for a minute, then keep reading to find out how I answered my Dad... 👇 AI vs Machine Learning Here's what I told my Dad: You can think of AI as a field dedicated to creating intelligent systems, and Machine...