{"library":"lovely-numpy","title":"Lovely-Numpy: Enhanced Array Representation","description":"lovely-numpy (version 0.2.22) is a utility library that enhances the default string representation of NumPy arrays, making them significantly more readable and debug-friendly. It achieves this by overriding `np.ndarray.__repr__` to display arrays with improved formatting, optional colors, configurable precision, and a more compact summary for large arrays. The library is actively maintained and released as needed for improvements and bug fixes, focusing on ease of use for interactive data exploration.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install lovely-numpy"],"cli":null},"imports":["import lovely_numpy as ln","import lovely_numpy as ln\nln.override_array_repr()"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import lovely_numpy as ln\nimport numpy as np\n\n# Apply lovely-numpy's enhanced representation\nln.override_array_repr()\n\n# Create a sample NumPy array\narr = np.random.randn(2, 3, 4) * 100 + 50 # Make it a bit more interesting\n\n# Print the array to see the lovely-numpy formatting\nprint(\"Original array:\")\nprint(arr)\n\n# You can also configure its behavior\nln.config(\n    precision=2,        # Display 2 decimal places\n    colored=True,       # Enable colored output\n    threshold=10,       # Apply repr for arrays with > 10 elements\n    science_mode=False  # Disable scientific notation for small numbers\n)\nprint(\"\\nArray with custom configuration:\")\nprint(arr)\n\n# Restore original numpy repr for specific sections if needed\nln.restore_array_repr()\nprint(\"\\nArray after restoring original numpy repr:\")\nprint(arr)\n","lang":"python","description":"Demonstrates how to activate the lovely-numpy array representation and configure its display options like precision and coloring. It also shows how to revert to the default NumPy representation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}