You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### For standard type sizes and manual alignment (padding) start format string with:
2011
2011
***`'='` - System's byte order (usually little-endian).**
2012
-
***`'<'` - Little-endian.**
2012
+
***`'<'` - Little-endian (i.e. least significant byte first).**
2013
2013
***`'>'` - Big-endian (also `'!'`).**
2014
2014
2015
2015
#### Besides numbers, pack() and unpack() also support bytes objects as part of the sequence:
2016
2016
***`'c'` - A bytes object with a single element. For pad byte use `'x'`.**
2017
-
***`'<n>s'` - A bytes object with n elements.**
2017
+
***`'<n>s'` - A bytes object with n elements (not effected by byte order).**
2018
2018
2019
2019
#### Integer types. Use a capital letter for unsigned type. Minimum and standard sizes are in brackets:
2020
2020
***`'b'` - char (1/1)**
@@ -2414,7 +2414,7 @@ plt.clf() # Clears the figure.
2414
2414
2415
2415
Table
2416
2416
-----
2417
-
#### Prints a CSV file as an ASCII table:
2417
+
#### Prints a CSV spreadsheet to the console:
2418
2418
```python
2419
2419
# $ pip3 install tabulate
2420
2420
import csv, tabulate
@@ -2676,7 +2676,7 @@ import numpy as np
2676
2676
<array>= np.tile/repeat(<array>, <int/list> [, axis]) # Tiles array or repeats its elements.
2677
2677
```
2678
2678
***Shape is a tuple of dimension sizes. A 100x50 RGB image has shape (50, 100, 3).**
2679
-
***Axis is an index of the dimension that gets aggregated. Leftmost dimension has index 0. Summing the RGB image along axis 2 will return a greyscale image with shape (50, 100).**
2679
+
***Axis is an index of a dimension. Leftmost dimension has index 0. Summing the RGB image along axis 2 will return a greyscale image with shape (50, 100).**
2680
2680
2681
2681
### Indexing
2682
2682
```perl
@@ -2858,21 +2858,21 @@ import wave
2858
2858
```
2859
2859
2860
2860
```python
2861
-
<Wave>= wave.open('<path>', 'rb') # Opens the WAV file.
2862
-
<int>=<Wave>.getframerate() # Returns number of frames per second.
2863
-
<int>=<Wave>.getnchannels() # Returns number of samples per frame.
2864
-
<int>=<Wave>.getsampwidth() # Returns number of bytes per sample.
2865
-
<params>=<Wave>.getparams() # Returns collection of listed params.
2866
-
<bytes>=<Wave>.readframes(nframes) # Returns next n frames. All if -1.
2861
+
<Wave>= wave.open('<path>', 'rb') # Opens the WAV file.
2862
+
<int>=<Wave>.getframerate() # Returns number of frames per second.
2863
+
<int>=<Wave>.getnchannels() # Returns number of samples per frame.
2864
+
<int>=<Wave>.getsampwidth() # Returns number of bytes per sample.
2865
+
<tuple>=<Wave>.getparams() # Returns namedtuple of all parameters.
2866
+
<bytes>=<Wave>.readframes(nframes) # Returns next n frames. All if -1.
2867
2867
```
2868
2868
2869
2869
```python
2870
-
<Wave>= wave.open('<path>', 'wb') # Opens WAV file for writing.
2871
-
<Wave>.setframerate(<int>) # Pass 44100 for CD, 48000 for video.
2872
-
<Wave>.setnchannels(<int>) # Pass 1 for mono, 2 for stereo.
2873
-
<Wave>.setsampwidth(<int>) # Pass 2 for CD, 3 for hi-res sound.
2874
-
<Wave>.setparams(<params>) # Sets all parameters.
2875
-
<Wave>.writeframes(<bytes>) # Appends frames to the file.
2870
+
<Wave>= wave.open('<path>', 'wb') # Creates/truncates a file for writing.
2871
+
<Wave>.setframerate(<int>) # Pass 44100 for CD, 48000 for video.
2872
+
<Wave>.setnchannels(<int>) # Pass 1 for mono, 2 for stereo.
2873
+
<Wave>.setsampwidth(<int>) # Pass 2 for CD, 3 for hi-res sound.
2874
+
<Wave>.setparams(<tuple>) # Sets all parameters.
2875
+
<Wave>.writeframes(<bytes>) # Appends frames to the file.
2876
2876
```
2877
2877
***Bytes object contains a sequence of frames, each consisting of one or more samples.**
2878
2878
***In a stereo signal, the first sample of a frame belongs to the left channel.**
@@ -3007,7 +3007,7 @@ while not pg.event.get(pg.QUIT):
3007
3007
3008
3008
```python
3009
3009
<bool>=<Rect>.collidepoint((x, y)) # Checks if rectangle contains the point.
3010
-
<bool>=<Rect>.colliderect(<Rect>) # Checks if two rectangles overlap.
3010
+
<bool>=<Rect>.colliderect(<Rect>) # Checks if the two rectangles overlap.
3011
3011
<int>=<Rect>.collidelist(<list_of_Rect>) # Returns index of first colliding Rect or -1.
3012
3012
<list>=<Rect>.collidelistall(<list_of_Rect>) # Returns indexes of all colliding rectangles.
3013
3013
```
@@ -3025,7 +3025,7 @@ while not pg.event.get(pg.QUIT):
3025
3025
```python
3026
3026
<Surf>.fill(color) # Tuple, Color('#rrggbb[aa]') or Color(<name>).
3027
3027
<Surf>.set_at((x, y), color) # Updates pixel. Also <Surf>.get_at((x, y)).
3028
-
<Surf>.blit(<Surf>, (x, y)) # Draws passed surface to the surface.
3028
+
<Surf>.blit(<Surf>, (x, y)) # Draws passed surface at specified location.
3029
3029
```
3030
3030
3031
3031
```python
@@ -3051,7 +3051,7 @@ rect(<Surf>, color, <Rect>, width=0) # Also polygon(<Surf>, color, po
3051
3051
### Sound
3052
3052
```python
3053
3053
<Sound>= pg.mixer.Sound(<path/file/bytes>) # WAV file or bytes/array of signed shorts.
3054
-
<Sound>.play/stop() # Also <Sound>.set_volume(<float>).
3054
+
<Sound>.play/stop() # Also set_volume(<float>), fadeout(msec).
3055
3055
```
3056
3056
3057
3057
### Basic Mario Brothers Example
@@ -3373,7 +3373,7 @@ c 7 8 6
3373
3373
<GB>=<DF>.groupby(column_key/s) # Splits DF into groups based on passed column.
3374
3374
<DF>=<GB>.apply(<func>) # Maps each group. Func can return DF, Sr or el.
3375
3375
<GB>=<GB>[column_key] # Single column GB. All operations return a Sr.
3376
-
<Sr>=<GB>.size() # A Sr of group sizes. Keys are group "names".
3376
+
<Sr>=<GB>.size() # A Sr of group sizes. Same keys as get_group().
0 commit comments