Index
50 questions available
Questions
In the context of NumPy's alternative sort algorithms, which algorithm is identified as the only available stable sort?
View answer and explanationWhen using NumPy's `lexsort` function with multiple key arrays, such as `np.lexsort((first_name, last_name))`, which key is used for sorting first?
View answer and explanationAccording to Table A-3 on array sorting methods, what is the worst-case performance of the 'quicksort' algorithm?
View answer and explanationWhat is the primary purpose of the `numpy.partition` function?
View answer and explanationWhat does `numpy.argpartition` return?
View answer and explanationWhat is the default behavior of `numpy.searchsorted` when searching for a value that is already present multiple times in a sorted array?
View answer and explanationHow can `numpy.searchsorted` be used for binning data, as demonstrated in the example with 'data' and 'bins' arrays?
View answer and explanationWhat is the primary function of the Numba library as described in the text?
View answer and explanationWhat does the `nopython=True` option in Numba's `jit` function do?
View answer and explanationWhat does the `numba.vectorize` function create?
View answer and explanationWhat is a memory-mapped file, as implemented by NumPy's `memmap` object?
View answer and explanationWhen you slice a NumPy `memmap` object, for example `section = mmap[:5]`, what is returned?
View answer and explanationWhen you assign data to a slice of a `memmap` object, when are the changes guaranteed to be written to the on-disk file?
View answer and explanationWhen opening an existing memory-mapped file with `np.memmap`, what information must you still provide besides the file path?
View answer and explanationWhich two Python projects are mentioned as providing NumPy-friendly interfaces for the HDF5 format?
View answer and explanationWhich of the following is listed as a performance tip for using NumPy?
View answer and explanationWhat does it mean for a NumPy array's memory layout to be 'C contiguous'?
View answer and explanationAccording to the example on page 506, which operation is theoretically faster on a 2D array: summing the rows of a C-contiguous array (`arr_c.sum(1)`) or a FORTRAN-contiguous array (`arr_f.sum(1)`)?
View answer and explanationIf you have a NumPy array that does not have the desired memory order (e.g., it is F-contiguous but you need C-contiguous for an operation), what function can you use to fix this?
View answer and explanationIn the IPython terminal, what is the keyboard shortcut `Ctrl-R` used for?
View answer and explanationWhat is the term for special commands in IPython that are prefixed with a percent symbol (percent) and are not part of Python itself?
View answer and explanationWhat is the 'automagic' feature in IPython?
View answer and explanationAccording to Table B-2, what is the purpose of the `%pdb` magic command?
View answer and explanationWhat is the primary difference between the `%time` and `%timeit` magic commands?
View answer and explanationWhen using the `%run` command to execute a script in IPython, in what kind of namespace is the script run by default?
View answer and explanationWhat happens when you press `Ctrl-C` while a long-running command or a script started with `%run` is executing?
View answer and explanationIn an IPython session, how can you access the result of the most recently evaluated expression that was not assigned to a variable?
View answer and explanationHow can you execute a system shell command, like `ls` or `dir`, from within an IPython session?
View answer and explanationWhat is the purpose of the IPython Directory Bookmark System?
View answer and explanationUnlike shell aliases defined with `%alias`, what is a key feature of directory bookmarks created with `%bookmark`?
View answer and explanationWhen is it considered one of the best times to use the `%debug` command in IPython?
View answer and explanationIn the IPython debugger (ipdb), how can you switch between different levels of the stack trace?
View answer and explanationHow does using the `-d` flag with the `%run` command (e.g., `%run -d my_script.py`) alter its execution?
View answer and explanationIn the IPython debugger, if a debugger command (like `n`) has the same name as a variable you want to inspect, how can you examine the variable's content?
View answer and explanationWhat is the main concern when using the Python `cProfile` module for profiling code?
View answer and explanationWhen running a script with `python -m cProfile`, what does the `-s cumulative` flag do?
View answer and explanationWhat is the purpose of the `line_profiler` library and its IPython extension `%lprun`?
View answer and explanationWhy must you explicitly specify which functions to profile when using `%lprun`?
View answer and explanationWhat problem does Python's 'load-once' module system present in interactive IPython development?
View answer and explanationWhat function from the standard library's `importlib` module can be used to attempt to reload a module that has been changed?
View answer and explanationAccording to the 'Code Design Tips', why is it generally better to have code execute in a module's global namespace rather than nested inside a `main()` function when developing for IPython?
View answer and explanationWhere are the configuration files for the IPython shell, such as `ipython_config.py`, typically found?
View answer and explanationWhat command do you run in the terminal to create an initial default IPython configuration file?
View answer and explanationHow can you create and use an alternative IPython configuration profile, separate from the default one?
View answer and explanationWhat command is used to generate a default configuration file for a Jupyter notebook?
View answer and explanationWhat does the IPython magic command `%reset` do?
View answer and explanationWhen might you encounter a `SettingWithCopyWarning` in pandas, according to the index?
View answer and explanationWhich magic command is described in Table B-2 as being able to 'Execute preformatted Python code from clipboard'?
View answer and explanationWhat is the key difference highlighted between `%paste` and `%cpaste` for executing code from the clipboard?
View answer and explanationWhen working with very large datasets, what potential memory problem related to IPython's history is mentioned?
View answer and explanation