Want to keep learning?

This content is taken from the The University of Glasgow's online course, Getting Started with Teaching Data Science in Schools. Join the course to learn more.

Skip to 0 minutes and 6 seconds JEREMY: Data is everywhere. It’s really important when we’re looking at data and analysing it to be able to describe the data properly. And the way to do this is to use data types in computing terms. Let’s look at a few examples. Here’s my dice. And this is a 20-sided dice from a Dungeons and Dragons game, I think. And when I roll it, it’s going to give me a number. So there, for instance, is the number 3. Every time I roll it, I’m going to get an integer, or whole number value. An integer is a specific data type. For instance, I might be observing the number of people in a building, it’s an integer.

Skip to 0 minutes and 58 seconds Or the number of legs that an insect has, it’s an integer. Sometimes when we’re measuring numerical data, however, it might not be integer whole number data. So I might be measuring the length of something. And that’s going to be a real number or a number with a decimal point, and the value after the decimal point. In computing terms, we can call these real numbers. Sometimes we call them floating point numbers. So for instance, my head circumference– hang on– is apparently 56.5 centimetres. Not sure that’s accurate. But you see, it’s not a whole number. It’s got a decimal point. And then a number after the decimal point. So this is a real number.

Skip to 1 minute and 45 seconds Or in computing terms, the data type is a floating point, 56.5. There are other data types as well. So here’s my University of Glasgow calendar, oh dear, from 2016. A little bit out of date. And we could take observations on certain days. And the day itself becomes a piece of data. So a date is another data type. For instance, a person’s birth date is a feature. And this has the date data type, recording the month and the year and the day, and so on. Sometimes, we describe data using words. So for instance, we might want to talk about places and place names are words. Here is Glasgow. And this is in data type terms a character string.

Skip to 2 minutes and 40 seconds Each letter is a single character. And we group them together to make this string of characters or word. String is the computing data type. And multiple words can be a string as well because space is a character too. So we could describe things like people’s jobs as character strings. Or perhaps we could describe the weather as a character string. Or perhaps it might be something else, like people’s comments, or opinions about a certain event. All these things could be character strings. One other data type we want to think about is the Boolean data type. And for this, we’re going to use the example of a light switch. The light switch is either on or off.

Skip to 3 minutes and 28 seconds And the Boolean data type is either true or false, on or off. All these data types we know map directly down to computer bits, ones and zeros. That’s easy for the Boolean case, isn’t it? One is true and zero is false. But when you collect together lots of bits, then you can represent more complex data types, like character strings and the integers and the dates and the floating point numbers.

Data types

Data comes in different shapes and sizes. We use data types to represent different values in computer code.

Regular types include integer for whole numbers, floating-point for non-whole numbers, boolean for true/false values, and string for textual data. Have you encountered data types in computer coding before?

Share this video:

This video is from the free online course:

Getting Started with Teaching Data Science in Schools

The University of Glasgow