doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
get_size() get the dimensions of the Surface get_size() -> (width, height) Return the width and height of the Surface in pixels.
pygame.ref.surface#pygame.Surface.get_size
get_view() return a buffer view of the Surface's pixels. get_view(<kind>='2') -> BufferProxy Return an object which exports a surface's internal pixel buffer as a C level array struct, Python level array interface or a C level buffer interface. The pixel buffer is writeable. The new buffer protocol is supported for ...
pygame.ref.surface#pygame.Surface.get_view
get_width() get the width of the Surface get_width() -> width Return the width of the Surface in pixels.
pygame.ref.surface#pygame.Surface.get_width
lock() lock the Surface memory for pixel access lock() -> None Lock the pixel data of a Surface for access. On accelerated Surfaces, the pixel data may be stored in volatile video memory or nonlinear compressed forms. When a Surface is locked the pixel memory becomes available to access by regular software. Code tha...
pygame.ref.surface#pygame.Surface.lock
map_rgb() convert a color into a mapped color value map_rgb(Color) -> mapped_int Convert an RGBA color into the mapped integer value for this Surface. The returned integer will contain no more bits than the bit depth of the Surface. Mapped color values are not often used inside pygame, but can be passed to most func...
pygame.ref.surface#pygame.Surface.map_rgb
mustlock() test if the Surface requires locking mustlock() -> bool Returns True if the Surface is required to be locked to access pixel data. Usually pure software Surfaces do not require locking. This method is rarely needed, since it is safe and quickest to just lock all Surfaces as needed. All pygame functions wi...
pygame.ref.surface#pygame.Surface.mustlock
scroll() Shift the surface image in place scroll(dx=0, dy=0) -> None Move the image by dx pixels right and dy pixels down. dx and dy may be negative for left and up scrolls respectively. Areas of the surface that are not overwritten retain their original pixel values. Scrolling is contained by the Surface clip area....
pygame.ref.surface#pygame.Surface.scroll
set_alpha() set the alpha value for the full Surface image set_alpha(value, flags=0) -> None set_alpha(None) -> None Set the current alpha value for the Surface. When blitting this Surface onto a destination, the pixels will be drawn slightly transparent. The alpha value is an integer from 0 to 255, 0 is fully trans...
pygame.ref.surface#pygame.Surface.set_alpha
set_at() set the color value for a single pixel set_at((x, y), Color) -> None Set the RGBA or mapped integer color value for a single pixel. If the Surface does not have per pixel alphas, the alpha value is ignored. Setting pixels outside the Surface area or outside the Surface clipping will have no effect. Getting ...
pygame.ref.surface#pygame.Surface.set_at
set_clip() set the current clipping area of the Surface set_clip(rect) -> None set_clip(None) -> None Each Surface has an active clipping area. This is a rectangle that represents the only pixels on the Surface that can be modified. If None is passed for the rectangle the full Surface will be available for changes. ...
pygame.ref.surface#pygame.Surface.set_clip
set_colorkey() Set the transparent colorkey set_colorkey(Color, flags=0) -> None set_colorkey(None) -> None Set the current color key for the Surface. When blitting this Surface onto a destination, any pixels that have the same color as the colorkey will be transparent. The color can be an RGB color or a mapped colo...
pygame.ref.surface#pygame.Surface.set_colorkey
set_masks() set the bitmasks needed to convert between a color and a mapped integer set_masks((r,g,b,a)) -> None This is not needed for normal pygame usage. Note In SDL2, the masks are read-only and accordingly this method will raise an AttributeError if called. New in pygame 1.8.1.
pygame.ref.surface#pygame.Surface.set_masks
set_palette() set the color palette for an 8-bit Surface set_palette([RGB, RGB, RGB, ...]) -> None Set the full palette for an 8-bit Surface. This will replace the colors in the existing palette. A partial palette can be passed and only the first colors in the original palette will be changed. This function has no e...
pygame.ref.surface#pygame.Surface.set_palette
set_palette_at() set the color for a single index in an 8-bit Surface palette set_palette_at(index, RGB) -> None Set the palette value for a single entry in a Surface palette. The index should be a value from 0 to 255. This function has no effect on a Surface with more than 8-bits per pixel.
pygame.ref.surface#pygame.Surface.set_palette_at
set_shifts() sets the bit shifts needed to convert between a color and a mapped integer set_shifts((r,g,b,a)) -> None This is not needed for normal pygame usage. Note In SDL2, the shifts are read-only and accordingly this method will raise an AttributeError if called. New in pygame 1.8.1.
pygame.ref.surface#pygame.Surface.set_shifts
subsurface() create a new surface that references its parent subsurface(Rect) -> Surface Returns a new Surface that shares its pixels with its new parent. The new Surface is considered a child of the original. Modifications to either Surface pixels will effect each other. Surface information like clipping area and c...
pygame.ref.surface#pygame.Surface.subsurface
unlock() unlock the Surface memory from pixel access unlock() -> None Unlock the Surface pixel data after it has been locked. The unlocked Surface can once again be drawn and managed by pygame. See the lock() documentation for more details. All pygame functions will automatically lock and unlock the Surface data as ...
pygame.ref.surface#pygame.Surface.unlock
unmap_rgb() convert a mapped integer color value into a Color unmap_rgb(mapped_int) -> Color Convert an mapped integer color into the RGB color components for this Surface. Mapped color values are not often used inside pygame, but can be passed to most functions that require a Surface and a color. See the Surface ob...
pygame.ref.surface#pygame.Surface.unmap_rgb
pygame.surfarray.array2d() Copy pixels into a 2d array array2d(Surface) -> array Copy the mapped (raw) pixels from a Surface into a 2D array. The bit depth of the surface will control the size of the integer values, and will work for any type of pixel format. This function will temporarily lock the Surface as pixels...
pygame.ref.surfarray#pygame.surfarray.array2d
pygame.surfarray.array3d() Copy pixels into a 3d array array3d(Surface) -> array Copy the pixels from a Surface into a 3D array. The bit depth of the surface will control the size of the integer values, and will work for any type of pixel format. This function will temporarily lock the Surface as pixels are copied (...
pygame.ref.surfarray#pygame.surfarray.array3d
pygame.surfarray.array_alpha() Copy pixel alphas into a 2d array array_alpha(Surface) -> array Copy the pixel alpha values (degree of transparency) from a Surface into a 2D array. This will work for any type of Surface format. Surfaces without a pixel alpha will return an array with all opaque values. This function ...
pygame.ref.surfarray#pygame.surfarray.array_alpha
pygame.surfarray.array_colorkey() Copy the colorkey values into a 2d array array_colorkey(Surface) -> array Create a new array with the colorkey transparency value from each pixel. If the pixel matches the colorkey it will be fully transparent; otherwise it will be fully opaque. This will work on any type of Surface...
pygame.ref.surfarray#pygame.surfarray.array_colorkey
pygame.surfarray.blit_array() Blit directly from a array values blit_array(Surface, array) -> None Directly copy values from an array into a Surface. This is faster than converting the array into a Surface and blitting. The array must be the same dimensions as the Surface and will completely replace all pixel values...
pygame.ref.surfarray#pygame.surfarray.blit_array
pygame.surfarray.get_arraytype() Gets the currently active array type. get_arraytype () -> str DEPRECATED: Returns the currently active array type. This will be a value of the get_arraytypes() tuple and indicates which type of array module is used for the array creation. New in pygame 1.8.
pygame.ref.surfarray#pygame.surfarray.get_arraytype
pygame.surfarray.get_arraytypes() Gets the array system types currently supported. get_arraytypes () -> tuple DEPRECATED: Checks, which array systems are available and returns them as a tuple of strings. The values of the tuple can be used directly in the pygame.surfarray.use_arraytype() () method. If no supported a...
pygame.ref.surfarray#pygame.surfarray.get_arraytypes
pygame.surfarray.make_surface() Copy an array to a new surface make_surface(array) -> Surface Create a new Surface that best resembles the data and format on the array. The array can be 2D or 3D with any sized integer values. Function make_surface uses the array struct interface to acquire array properties, so is no...
pygame.ref.surfarray#pygame.surfarray.make_surface
pygame.surfarray.map_array() Map a 3d array into a 2d array map_array(Surface, array3d) -> array2d Convert a 3D array into a 2D array. This will use the given Surface format to control the conversion. Palette surface formats are supported for NumPy arrays.
pygame.ref.surfarray#pygame.surfarray.map_array
pygame.surfarray.pixels2d() Reference pixels into a 2d array pixels2d(Surface) -> array Create a new 2D array that directly references the pixel values in a Surface. Any changes to the array will affect the pixels in the Surface. This is a fast operation since no data is copied. Pixels from a 24-bit Surface cannot b...
pygame.ref.surfarray#pygame.surfarray.pixels2d
pygame.surfarray.pixels3d() Reference pixels into a 3d array pixels3d(Surface) -> array Create a new 3D array that directly references the pixel values in a Surface. Any changes to the array will affect the pixels in the Surface. This is a fast operation since no data is copied. This will only work on Surfaces that ...
pygame.ref.surfarray#pygame.surfarray.pixels3d
pygame.surfarray.pixels_alpha() Reference pixel alphas into a 2d array pixels_alpha(Surface) -> array Create a new 2D array that directly references the alpha values (degree of transparency) in a Surface. Any changes to the array will affect the pixels in the Surface. This is a fast operation since no data is copied...
pygame.ref.surfarray#pygame.surfarray.pixels_alpha
pygame.surfarray.pixels_blue() Reference pixel blue into a 2d array. pixels_blue (Surface) -> array Create a new 2D array that directly references the blue values in a Surface. Any changes to the array will affect the pixels in the Surface. This is a fast operation since no data is copied. This can only work on 24-b...
pygame.ref.surfarray#pygame.surfarray.pixels_blue
pygame.surfarray.pixels_green() Reference pixel green into a 2d array. pixels_green (Surface) -> array Create a new 2D array that directly references the green values in a Surface. Any changes to the array will affect the pixels in the Surface. This is a fast operation since no data is copied. This can only work on ...
pygame.ref.surfarray#pygame.surfarray.pixels_green
pygame.surfarray.pixels_red() Reference pixel red into a 2d array. pixels_red (Surface) -> array Create a new 2D array that directly references the red values in a Surface. Any changes to the array will affect the pixels in the Surface. This is a fast operation since no data is copied. This can only work on 24-bit o...
pygame.ref.surfarray#pygame.surfarray.pixels_red
pygame.surfarray.use_arraytype() Sets the array system to be used for surface arrays use_arraytype (arraytype) -> None DEPRECATED: Uses the requested array type for the module functions. The only supported arraytype is 'numpy'. Other values will raise ValueError.
pygame.ref.surfarray#pygame.surfarray.use_arraytype
pygame.tests.run() Run the pygame unit test suite run(*args, **kwds) -> tuple Positional arguments (optional): The names of tests to include. If omitted then all tests are run. Test names need not include the trailing '_test'. Keyword arguments: incomplete - fail incomplete tests (default False) nosubprocess - run a...
pygame.ref.tests#pygame.tests.run
pygame.time.Clock create an object to help track time Clock() -> Clock Creates a new Clock object that can be used to track an amount of time. The clock also provides several functions to help control a game's framerate. tick() update the clock tick(framerate=0) -> milliseconds This method should be called once...
pygame.ref.time#pygame.time.Clock
get_fps() compute the clock framerate get_fps() -> float Compute your game's framerate (in frames per second). It is computed by averaging the last ten calls to Clock.tick().
pygame.ref.time#pygame.time.Clock.get_fps
get_rawtime() actual time used in the previous tick get_rawtime() -> milliseconds Similar to Clock.get_time(), but does not include any time used while Clock.tick() was delaying to limit the framerate.
pygame.ref.time#pygame.time.Clock.get_rawtime
get_time() time used in the previous tick get_time() -> milliseconds The number of milliseconds that passed between the previous two calls to Clock.tick().
pygame.ref.time#pygame.time.Clock.get_time
tick() update the clock tick(framerate=0) -> milliseconds This method should be called once per frame. It will compute how many milliseconds have passed since the previous call. If you pass the optional framerate argument the function will delay to keep the game running slower than the given ticks per second. This c...
pygame.ref.time#pygame.time.Clock.tick
tick_busy_loop() update the clock tick_busy_loop(framerate=0) -> milliseconds This method should be called once per frame. It will compute how many milliseconds have passed since the previous call. If you pass the optional framerate argument the function will delay to keep the game running slower than the given tick...
pygame.ref.time#pygame.time.Clock.tick_busy_loop
pygame.time.delay() pause the program for an amount of time delay(milliseconds) -> time Will pause for a given number of milliseconds. This function will use the processor (rather than sleeping) in order to make the delay more accurate than pygame.time.wait(). This returns the actual number of milliseconds used.
pygame.ref.time#pygame.time.delay
pygame.time.get_ticks() get the time in milliseconds get_ticks() -> milliseconds Return the number of milliseconds since pygame.init() was called. Before pygame is initialized this will always be 0.
pygame.ref.time#pygame.time.get_ticks
pygame.time.set_timer() repeatedly create an event on the event queue set_timer(eventid, milliseconds) -> None set_timer(eventid, milliseconds, once) -> None Set an event type to appear on the event queue every given number of milliseconds. The first event will not appear until the amount of time has passed. Every e...
pygame.ref.time#pygame.time.set_timer
pygame.time.wait() pause the program for an amount of time wait(milliseconds) -> time Will pause for a given number of milliseconds. This function sleeps the process to share the processor with other programs. A program that waits for even a few milliseconds will consume very little processor time. It is slightly le...
pygame.ref.time#pygame.time.wait
pygame.transform.average_color() finds the average color of a surface average_color(Surface, Rect = None) -> Color Finds the average color of a Surface or a region of a surface specified by a Rect, and returns it as a Color.
pygame.ref.transform#pygame.transform.average_color
pygame.transform.average_surfaces() find the average surface from many surfaces. average_surfaces(Surfaces, DestSurface = None, palette_colors = 1) -> Surface Takes a sequence of surfaces and returns a surface with average colors from each of the surfaces. palette_colors - if true we average the colors in palette, o...
pygame.ref.transform#pygame.transform.average_surfaces
pygame.transform.chop() gets a copy of an image with an interior area removed chop(Surface, rect) -> Surface Extracts a portion of an image. All vertical and horizontal pixels surrounding the given rectangle area are removed. The corner areas (diagonal to the rect) are then brought together. (The original image is n...
pygame.ref.transform#pygame.transform.chop
pygame.transform.flip() flip vertically and horizontally flip(Surface, xbool, ybool) -> Surface This can flip a Surface either vertically, horizontally, or both. Flipping a Surface is non-destructive and returns a new Surface with the same dimensions.
pygame.ref.transform#pygame.transform.flip
pygame.transform.get_smoothscale_backend() return smoothscale filter version in use: 'GENERIC', 'MMX', or 'SSE' get_smoothscale_backend() -> String Shows whether or not smoothscale is using MMX or SSE acceleration. If no acceleration is available then "GENERIC" is returned. For a x86 processor the level of accelerat...
pygame.ref.transform#pygame.transform.get_smoothscale_backend
pygame.transform.laplacian() find edges in a surface laplacian(Surface, DestSurface = None) -> Surface Finds the edges in a surface using the laplacian algorithm. New in pygame 1.8.
pygame.ref.transform#pygame.transform.laplacian
pygame.transform.rotate() rotate an image rotate(Surface, angle) -> Surface Unfiltered counterclockwise rotation. The angle argument represents degrees and can be any floating point value. Negative angle amounts will rotate clockwise. Unless rotating by 90 degree increments, the image will be padded larger to hold t...
pygame.ref.transform#pygame.transform.rotate
pygame.transform.rotozoom() filtered scale and rotation rotozoom(Surface, angle, scale) -> Surface This is a combined scale and rotation transform. The resulting Surface will be a filtered 32-bit Surface. The scale argument is a floating point value that will be multiplied by the current resolution. The angle argume...
pygame.ref.transform#pygame.transform.rotozoom
pygame.transform.scale() resize to new resolution scale(Surface, (width, height), DestSurface = None) -> Surface Resizes the Surface to a new resolution. This is a fast scale operation that does not sample the results. An optional destination surface can be used, rather than have it create a new one. This is quicker...
pygame.ref.transform#pygame.transform.scale
pygame.transform.scale2x() specialized image doubler scale2x(Surface, DestSurface = None) -> Surface This will return a new image that is double the size of the original. It uses the AdvanceMAME Scale2X algorithm which does a 'jaggie-less' scale of bitmap graphics. This really only has an effect on simple images wit...
pygame.ref.transform#pygame.transform.scale2x
pygame.transform.set_smoothscale_backend() set smoothscale filter version to one of: 'GENERIC', 'MMX', or 'SSE' set_smoothscale_backend(type) -> None Sets smoothscale acceleration. Takes a string argument. A value of 'GENERIC' turns off acceleration. 'MMX' uses MMX instructions only. 'SSE' allows SSE extensions as w...
pygame.ref.transform#pygame.transform.set_smoothscale_backend
pygame.transform.smoothscale() scale a surface to an arbitrary size smoothly smoothscale(Surface, (width, height), DestSurface = None) -> Surface Uses one of two different algorithms for scaling each dimension of the input surface as required. For shrinkage, the output pixels are area averages of the colors they cov...
pygame.ref.transform#pygame.transform.smoothscale
pygame.transform.threshold() finds which, and how many pixels in a surface are within a threshold of a 'search_color' or a 'search_surf'. threshold(dest_surf, surf, search_color, threshold=(0,0,0,0), set_color=(0,0,0,0), set_behavior=1, search_surf=None, inverse_set=False) -> num_threshold_pixels This versatile func...
pygame.ref.transform#pygame.transform.threshold
pygame.version.rev repository revision of the build rev = 'a6f89747b551+' The Mercurial node identifier of the repository checkout from which this package was built. If the identifier ends with a plus sign '+' then the package contains uncommitted changes. Please include this revision number in bug reports, especial...
pygame.ref.pygame#pygame.version.rev
pygame.version.SDL tupled integers of the SDL library version SDL = '(2, 0, 12)' This is the SDL library version represented as an extended tuple. It also has attributes 'major', 'minor' & 'patch' that can be accessed like this: >>> pygame.version.SDL.major 2 printing the whole thing returns a string like this: >>> ...
pygame.ref.pygame#pygame.version.SDL
pygame.version.ver version number as a string ver = '1.2' This is the version represented as a string. It can contain a micro release number as well, e.g. '1.5.2'
pygame.ref.pygame#pygame.version.ver
pygame.version.vernum tupled integers of the version vernum = (1, 5, 3) This version information can easily be compared with other version numbers of the same format. An example of checking pygame version numbers would look like this: if pygame.version.vernum < (1, 5): print('Warning, older version of pygame (%s...
pygame.ref.pygame#pygame.version.vernum
Cookbook This is a repository for short and sweet examples and links for useful pandas recipes. We encourage users to add to this documentation. Adding interesting links and/or inline examples to this section is a great First Pull Request. Simplified, condensed, new-user friendly, in-line examples have been inserted wh...
pandas.user_guide.cookbook
DataFrame Constructor DataFrame([data, index, columns, dtype, copy]) Two-dimensional, size-mutable, potentially heterogeneous tabular data. Attributes and underlying data Axes DataFrame.index The index (row labels) of the DataFrame. DataFrame.columns The column labels of the DataFrame. D...
pandas.reference.frame
Extensions These are primarily intended for library authors looking to extend pandas objects. api.extensions.register_extension_dtype(cls) Register an ExtensionType with pandas as class decorator. api.extensions.register_dataframe_accessor(name) Register a custom accessor on DataFrame objects. api.extensions...
pandas.reference.extensions
GroupBy GroupBy objects are returned by groupby calls: pandas.DataFrame.groupby(), pandas.Series.groupby(), etc. Indexing, iteration GroupBy.__iter__() Groupby iterator. GroupBy.groups Dict {group name -> group labels}. GroupBy.indices Dict {group name -> group indices}. GroupBy.get_group(name[, obj]) Con...
pandas.reference.groupby
Input/output Pickling read_pickle(filepath_or_buffer[, ...]) Load pickled pandas object (or any object) from file. DataFrame.to_pickle(path[, compression, ...]) Pickle (serialize) object to file. Flat file read_table(filepath_or_buffer[, sep, ...]) Read general delimited file into DataFrame. rea...
pandas.reference.io
pandas.api.extensions.ExtensionArray classpandas.api.extensions.ExtensionArray[source] Abstract base class for custom 1-D array types. pandas will recognize instances of this class as proper arrays with a custom type and will not attempt to coerce them to objects. They may be stored directly inside a DataFrame or S...
pandas.reference.api.pandas.api.extensions.extensionarray
pandas.api.extensions.ExtensionArray._concat_same_type classmethodExtensionArray._concat_same_type(to_concat)[source] Concatenate multiple array of this dtype. Parameters to_concat:sequence of this type Returns ExtensionArray
pandas.reference.api.pandas.api.extensions.extensionarray._concat_same_type
pandas.api.extensions.ExtensionArray._formatter ExtensionArray._formatter(boxed=False)[source] Formatting function for scalar values. This is used in the default ‘__repr__’. The returned formatting function receives instances of your scalar type. Parameters boxed:bool, default False An indicated for whether o...
pandas.reference.api.pandas.api.extensions.extensionarray._formatter
pandas.api.extensions.ExtensionArray._from_factorized classmethodExtensionArray._from_factorized(values, original)[source] Reconstruct an ExtensionArray after factorization. Parameters values:ndarray An integer ndarray with the factorized values. original:ExtensionArray The original ExtensionArray that fa...
pandas.reference.api.pandas.api.extensions.extensionarray._from_factorized
pandas.api.extensions.ExtensionArray._from_sequence classmethodExtensionArray._from_sequence(scalars, *, dtype=None, copy=False)[source] Construct a new ExtensionArray from a sequence of scalars. Parameters scalars:Sequence Each element will be an instance of the scalar type for this array, cls.dtype.type or ...
pandas.reference.api.pandas.api.extensions.extensionarray._from_sequence
pandas.api.extensions.ExtensionArray._from_sequence_of_strings classmethodExtensionArray._from_sequence_of_strings(strings, *, dtype=None, copy=False)[source] Construct a new ExtensionArray from a sequence of strings. Parameters strings:Sequence Each element will be an instance of the scalar type for this arr...
pandas.reference.api.pandas.api.extensions.extensionarray._from_sequence_of_strings
pandas.api.extensions.ExtensionArray._reduce ExtensionArray._reduce(name, *, skipna=True, **kwargs)[source] Return a scalar result of performing the reduction operation. Parameters name:str Name of the function, supported values are: { any, all, min, max, sum, mean, median, prod, std, var, sem, kurt, skew }. ...
pandas.reference.api.pandas.api.extensions.extensionarray._reduce
pandas.api.extensions.ExtensionArray._values_for_argsort ExtensionArray._values_for_argsort()[source] Return values for sorting. Returns ndarray The transformed values should maintain the ordering between values within the array. See also ExtensionArray.argsort Return the indices that would sort this arr...
pandas.reference.api.pandas.api.extensions.extensionarray._values_for_argsort
pandas.api.extensions.ExtensionArray._values_for_factorize ExtensionArray._values_for_factorize()[source] Return an array and missing value suitable for factorization. Returns values:ndarray An array suitable for factorization. This should maintain order and be a supported dtype (Float64, Int64, UInt64, Strin...
pandas.reference.api.pandas.api.extensions.extensionarray._values_for_factorize
pandas.api.extensions.ExtensionArray.argsort ExtensionArray.argsort(ascending=True, kind='quicksort', na_position='last', *args, **kwargs)[source] Return the indices that would sort this array. Parameters ascending:bool, default True Whether the indices should result in an ascending or descending sort. kind...
pandas.reference.api.pandas.api.extensions.extensionarray.argsort
pandas.api.extensions.ExtensionArray.astype ExtensionArray.astype(dtype, copy=True)[source] Cast to a NumPy array or ExtensionArray with ‘dtype’. Parameters dtype:str or dtype Typecode or data-type to which the array is cast. copy:bool, default True Whether to copy the data, even if not necessary. If Fals...
pandas.reference.api.pandas.api.extensions.extensionarray.astype
pandas.api.extensions.ExtensionArray.copy ExtensionArray.copy()[source] Return a copy of the array. Returns ExtensionArray
pandas.reference.api.pandas.api.extensions.extensionarray.copy
pandas.api.extensions.ExtensionArray.dropna ExtensionArray.dropna()[source] Return ExtensionArray without NA values. Returns valid:ExtensionArray
pandas.reference.api.pandas.api.extensions.extensionarray.dropna
pandas.api.extensions.ExtensionArray.dtype propertyExtensionArray.dtype An instance of ‘ExtensionDtype’.
pandas.reference.api.pandas.api.extensions.extensionarray.dtype
pandas.api.extensions.ExtensionArray.equals ExtensionArray.equals(other)[source] Return if another array is equivalent to this array. Equivalent means that both arrays have the same shape and dtype, and all values compare equal. Missing values in the same location are considered equal (in contrast with normal equal...
pandas.reference.api.pandas.api.extensions.extensionarray.equals
pandas.api.extensions.ExtensionArray.factorize ExtensionArray.factorize(na_sentinel=- 1)[source] Encode the extension array as an enumerated type. Parameters na_sentinel:int, default -1 Value to use in the codes array to indicate missing values. Returns codes:ndarray An integer NumPy array that’s an i...
pandas.reference.api.pandas.api.extensions.extensionarray.factorize
pandas.api.extensions.ExtensionArray.fillna ExtensionArray.fillna(value=None, method=None, limit=None)[source] Fill NA/NaN values using the specified method. Parameters value:scalar, array-like If a scalar value is passed it is used to fill all missing values. Alternatively, an array-like ‘value’ can be given...
pandas.reference.api.pandas.api.extensions.extensionarray.fillna
pandas.api.extensions.ExtensionArray.insert ExtensionArray.insert(loc, item)[source] Insert an item at the given position. Parameters loc:int item:scalar-like Returns same type as self Notes This method should be both type and dtype-preserving. If the item cannot be held in an array of this type/dtype...
pandas.reference.api.pandas.api.extensions.extensionarray.insert
pandas.api.extensions.ExtensionArray.isin ExtensionArray.isin(values)[source] Pointwise comparison for set containment in the given values. Roughly equivalent to np.array([x in values for x in self]) Parameters values:Sequence Returns np.ndarray[bool]
pandas.reference.api.pandas.api.extensions.extensionarray.isin
pandas.api.extensions.ExtensionArray.isna ExtensionArray.isna()[source] A 1-D array indicating if each value is missing. Returns na_values:Union[np.ndarray, ExtensionArray] In most cases, this should return a NumPy ndarray. For exceptional cases like SparseArray, where returning an ndarray would be expensive,...
pandas.reference.api.pandas.api.extensions.extensionarray.isna
pandas.api.extensions.ExtensionArray.nbytes propertyExtensionArray.nbytes The number of bytes needed to store this object in memory.
pandas.reference.api.pandas.api.extensions.extensionarray.nbytes
pandas.api.extensions.ExtensionArray.ndim propertyExtensionArray.ndim Extension Arrays are only allowed to be 1-dimensional.
pandas.reference.api.pandas.api.extensions.extensionarray.ndim
pandas.api.extensions.ExtensionArray.ravel ExtensionArray.ravel(order='C')[source] Return a flattened view on this array. Parameters order:{None, ‘C’, ‘F’, ‘A’, ‘K’}, default ‘C’ Returns ExtensionArray Notes Because ExtensionArrays are 1D-only, this is a no-op. The “order” argument is ignored, is for c...
pandas.reference.api.pandas.api.extensions.extensionarray.ravel
pandas.api.extensions.ExtensionArray.repeat ExtensionArray.repeat(repeats, axis=None)[source] Repeat elements of a ExtensionArray. Returns a new ExtensionArray where each element of the current ExtensionArray is repeated consecutively a given number of times. Parameters repeats:int or array of ints The number...
pandas.reference.api.pandas.api.extensions.extensionarray.repeat
pandas.api.extensions.ExtensionArray.searchsorted ExtensionArray.searchsorted(value, side='left', sorter=None)[source] Find indices where elements should be inserted to maintain order. Find the indices into a sorted array self (a) such that, if the corresponding elements in value were inserted before the indices, t...
pandas.reference.api.pandas.api.extensions.extensionarray.searchsorted
pandas.api.extensions.ExtensionArray.shape propertyExtensionArray.shape Return a tuple of the array dimensions.
pandas.reference.api.pandas.api.extensions.extensionarray.shape
pandas.api.extensions.ExtensionArray.shift ExtensionArray.shift(periods=1, fill_value=None)[source] Shift values by desired number. Newly introduced missing values are filled with self.dtype.na_value. Parameters periods:int, default 1 The number of periods to shift. Negative values are allowed for shifting ba...
pandas.reference.api.pandas.api.extensions.extensionarray.shift
pandas.api.extensions.ExtensionArray.take ExtensionArray.take(indices, *, allow_fill=False, fill_value=None)[source] Take elements from an array. Parameters indices:sequence of int or one-dimensional np.ndarray of int Indices to be taken. allow_fill:bool, default False How to handle negative values in ind...
pandas.reference.api.pandas.api.extensions.extensionarray.take
pandas.api.extensions.ExtensionArray.tolist ExtensionArray.tolist()[source] Return a list of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period) Returns list
pandas.reference.api.pandas.api.extensions.extensionarray.tolist
pandas.api.extensions.ExtensionArray.unique ExtensionArray.unique()[source] Compute the ExtensionArray of unique values. Returns uniques:ExtensionArray
pandas.reference.api.pandas.api.extensions.extensionarray.unique
pandas.api.extensions.ExtensionArray.view ExtensionArray.view(dtype=None)[source] Return a view on the array. Parameters dtype:str, np.dtype, or ExtensionDtype, optional Default None. Returns ExtensionArray or np.ndarray A view on the ExtensionArray’s data.
pandas.reference.api.pandas.api.extensions.extensionarray.view
pandas.api.extensions.ExtensionDtype classpandas.api.extensions.ExtensionDtype[source] A custom data type, to be paired with an ExtensionArray. See also extensions.register_extension_dtype Register an ExtensionType with pandas as class decorator. extensions.ExtensionArray Abstract base class for custom 1-D arr...
pandas.reference.api.pandas.api.extensions.extensiondtype
pandas.api.extensions.ExtensionDtype.construct_array_type classmethodExtensionDtype.construct_array_type()[source] Return the array type associated with this dtype. Returns type
pandas.reference.api.pandas.api.extensions.extensiondtype.construct_array_type