打开

Preparing data

让数据就绪

After you’ve collected the ingredients you want for your recipe, you have to prepare them before you start cooking. This is the prep step, in which you wash, chop, and otherwise get your ingredients ready. Many of us dislike this step because it isn’t much fun, but if you’ve ever had a dish with dirty vegetables, you know firsthand how much the end result can suffer if this step is done poorly or skipped altogether!

为菜谱收集到你想要的食材后,在开始烹饪前你必须准备它们。准备步骤中你要清洗、切片和其他种种,让食材就绪。我们很多人不喜欢这个步骤因为它很无趣,但是如果你吃过用不干净的蔬菜做的菜,你就会切身体会到在这个步骤敷衍或干脆直接略过会让你忍受怎样痛苦的恶果。

As in cooking, many also dislike the prep step when working with data, but it is necessary. You can’t just grab the data, throw it into a visualization, and expect it to come out right. If you want to create the best graphics you can, you need to make sure your data is prepared correctly. Some of your data may need to be separated into different groups, some may need converting, and some may need to be cleaned, like the vegetables.

如同烹饪,在数据处理中很多人也不喜欢这个步骤,但这是必须的。你没法拿到数据,就丢到可视化中,并期待正确的结果。如果你想尽你所能创建最好的图,你需要确保数据被正确的准备好。就如果蔬菜一样,一些数据可能需要从其他类型中分离出来,一些需要进行转换,一些需要清理。

In this section, we’ll talk about some of the common preparation and cleaning tasks encountered when working with data, and about ways that you can potentially decrease the amount of time you’ll need to spend doing them. No matter how you slice it, if you get your data set up the right way, it will make everything a go a lot smoother when you get to the visualization stage.

在这部分,我们将介绍数据处理中面对的一些常用的准备和清理任务,以及可能降低做这些所花时间的方法。无论怎么切分,如果能正确地把数据准备妥当,当你进行可视化阶段时,一切将变得顺畅。