Data Type Constraints Flashcards
When working with new data, what method you should use to check the data types of your columns?
.dtypes
.info()
What function computes a summary of statistics pertaining to the DataFrame columns?
.describe()
What is a pandas data type corresponding to categorical variables in statistics and takes on a limited, and usually fixed, number of possible values?
Category
What are some examples of Categorical variables?
Examples are gender, social class, blood type, country affiliation, observation time or rating via Likert scales.
What is categorical data?
might have an order (e.g. ‘strongly agree’ vs ‘agree’ or ‘first observation’ vs. ‘second observation’), but numerical operations (additions, divisions, …) are not possible
What method is used to cast a pandas object to a specified dtype? What function also provides the capability to convert any suitable existing column to a categorical type?
.astype()
What is a object that describes how the bytes in the fixed-size block of memory corresponding to an array item should be interpreted?
Type of the data (integer, float, Python object, etc.)
Size of the data (how many bytes is in e.g. the integer)
Byte order of the data (little-endian or big-endian)
.dtype()
What is used when debugging code? The keyword lets you test if a condition in your code returns True, if not, the program will raise an Error.
Assert Statement
What method removes characters from both left and right based on the argument (a string specifying the set of characters to be removed)?
.strip()