0
0
Pandasdata~5 mins

Numeric types (int64, float64) in Pandas - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is int64 in pandas?

int64 is a numeric data type in pandas used to store whole numbers (integers) with 64-bit precision. It can hold both positive and negative integers.

Click to reveal answer
beginner
What does float64 represent in pandas?

float64 is a numeric data type in pandas used to store decimal numbers (floating-point numbers) with 64-bit precision. It can represent numbers with fractions.

Click to reveal answer
beginner
Why would you choose float64 over int64 in a DataFrame?

You choose float64 when your data contains decimal values or fractions. int64 is only for whole numbers without decimals.

Click to reveal answer
beginner
How can you check the data type of a pandas DataFrame column?

You can use df['column_name'].dtype to see the data type of a specific column in a pandas DataFrame.

Click to reveal answer
intermediate
What happens if you try to store a decimal number in an int64 column?

The decimal part will be dropped (truncated), and only the whole number part will be stored. This can lead to loss of information.

Click to reveal answer
Which pandas data type is best for storing whole numbers?
Abool
Bfloat64
Cint64
Dobject
What does float64 allow you to store that int64 does not?
ADecimal numbers
BNegative numbers
CText strings
DBoolean values
How do you check the data type of a pandas DataFrame column named 'age'?
Adf.age.type()
Bdf['age'].dtype
Cdf.type('age')
Ddf['age'].type
If you store 3.7 in an int64 column, what happens?
AIt stores 3
BIt stores 4
CIt stores 3.7 exactly
DIt causes an error
Which of these is NOT a numeric type in pandas?
Aint64
Bint32
Cfloat64
Dobject
Explain the difference between int64 and float64 in pandas.
Think about whether the number has decimals or not.
You got /3 concepts.
    How can you find out the data type of a column in a pandas DataFrame?
    It's a property of the column, not a method.
    You got /2 concepts.