Return the current print options. Returns ------- print_opts : dict Dictionary of current print options with keys - precision : int - threshold : int - edgeitems : int - linewidth : int - suppress : bool - nanstr : str
()
| 334 | |
| 335 | @set_module('numpy') |
| 336 | def get_printoptions(): |
| 337 | """ |
| 338 | Return the current print options. |
| 339 | |
| 340 | Returns |
| 341 | ------- |
| 342 | print_opts : dict |
| 343 | Dictionary of current print options with keys |
| 344 | |
| 345 | - precision : int |
| 346 | - threshold : int |
| 347 | - edgeitems : int |
| 348 | - linewidth : int |
| 349 | - suppress : bool |
| 350 | - nanstr : str |
| 351 | - infstr : str |
| 352 | - sign : str |
| 353 | - formatter : dict of callables |
| 354 | - floatmode : str |
| 355 | - legacy : str or False |
| 356 | |
| 357 | For a full description of these options, see `set_printoptions`. |
| 358 | |
| 359 | Notes |
| 360 | ----- |
| 361 | These print options apply only to NumPy ndarrays, not to scalars. |
| 362 | |
| 363 | **Concurrency note:** see :ref:`text_formatting_options` |
| 364 | |
| 365 | See Also |
| 366 | -------- |
| 367 | set_printoptions, printoptions |
| 368 | |
| 369 | Examples |
| 370 | -------- |
| 371 | >>> import numpy as np |
| 372 | |
| 373 | >>> np.get_printoptions() |
| 374 | {'edgeitems': 3, 'threshold': 1000, ..., 'override_repr': None} |
| 375 | |
| 376 | >>> np.get_printoptions()['linewidth'] |
| 377 | 75 |
| 378 | >>> np.set_printoptions(linewidth=100) |
| 379 | >>> np.get_printoptions()['linewidth'] |
| 380 | 100 |
| 381 | |
| 382 | """ |
| 383 | opts = format_options.get().copy() |
| 384 | opts['legacy'] = { |
| 385 | 113: '1.13', 121: '1.21', 125: '1.25', 201: '2.1', |
| 386 | 202: '2.2', sys.maxsize: False, |
| 387 | }[opts['legacy']] |
| 388 | return opts |
| 389 | |
| 390 | |
| 391 | def _get_legacy_print_mode(): |
no test coverage detected
searching dependent graphs…