Pythoug

 0    20 flashcards    teddonav
tải về mp3 In chơi tự kiểm tra
 
câu hỏi English câu trả lời English
What is the difference in data type consistency between a list and a Series?
bắt đầu học
A list can contain elements of different data types, whereas a Series is designed to hold elements of the same data type for more efficient processing.
How does indexing differ between a list and a Series?
bắt đầu học
A list is indexed by a range of integers starting from 0, while a Series can have custom index labels, not limited to integer positions.
What are the differences in functionality and methods between a list and a Series?
bắt đầu học
A list has basic functionality like adding, removing, or changing elements. A Series comes with more complex operations, including handling missing data, statistical operations, and time-series functionality.
Which has better performance for large datasets, a list or a Series?
bắt đầu học
A Series is optimized for performance, especially with large datasets, as it is built on top of NumPy, while lists are less efficient for such operations.
What is the difference in data alignment capabilities between a list and a Series?
bắt đầu học
Lists do not support data alignment features. Series support automatic data alignment based on index labels, useful in data analysis.
How does handling of missing data differ between a list and a Series?
bắt đầu học
Lists have no built-in support for handling missing data, while Series have integrated handling for missing data (like NaN values).
What are the library dependencies for lists and Series?
bắt đầu học
Lists are a core part of Python and require no additional libraries. Series are part of the pandas library, which must be installed and imported.
How do lists and Series differ in representing 2D data?
bắt đầu học
Lists can be nested to represent 2D data but lack special functionality. For 2D data, pandas uses a DataFrame, which is a collection of Series.
Which uses more memory, a list or a Series?
bắt đầu học
Generally, lists use more memory, while Series are more memory-efficient, especially for large datasets.
Do lists and Series support vectorized operations?
bắt đầu học
Lists do not support vectorized operations natively, while Series support vectorized operations, enhancing calculation efficiency across elements.
How do order and indexing differ between a list and a set?
bắt đầu học
Lists are ordered and support indexing; sets are unordered and do not support indexing.
Can lists and sets contain duplicate elements?
bắt đầu học
Lists can contain duplicates; sets automatically remove duplicates and only store unique elements.
How are lists and sets mutable?
bắt đầu học
Lists are mutable and can have elements added, removed, or changed. Sets are mutable in terms of adding or removing elements, but the elements themselves must be immutable.
What brackets are used to define lists and sets?
bắt đầu học
Lists are defined with square brackets [], while sets are defined with curly braces {} or the set() constructor for empty sets.
What types of elements can lists and sets contain?
bắt đầu học
Lists can contain different types, including other lists. Sets can only contain hashable (immutable) types and cannot have lists as elements.
What are the typical usages of lists and sets?
bắt đầu học
Lists are used for ordered sequences of items; sets are used for membership testing, removing duplicates, and set operations like unions and intersections.
How does performance in membership testing compare between a list and a set?
bắt đầu học
Membership testing is slower in lists as it scans the list, but faster in sets due to their hash table implementation.
What methods are unique to lists and sets?
bắt đầu học
Lists have methods like append(), extend(), insert(), pop(), remove(), etc. Sets have methods like add(), remove(), discard(), and set-specific operations like union(), intersection(), etc.
How do you define an empty list and an empty set?
bắt đầu học
An empty list is defined as [], while an empty set is defined as set().
What is the difference in element mutability between a list and a set?
bắt đầu học
Both lists and sets are mutable, but while list elements can be mutable, set elements must be immutable.

Bạn phải đăng nhập để đăng bình luận.