Reinforcement learning-Q_learning algorithm encountered some python function problems

1. pd.DataFrame() function:

There are two main data structures of the Pandas module: 1.Series 2.DataFrame

The intuitive understanding of DataFrame() is to create a table,
the default parameters:

def __init__(self,
             data: Any = None,
             index: Optional[Collection] = None,
             columns: Optional[Collection] = None,
             dtype: Union[ExtensionDtype, str, dtype, dtype, Type[str], Type[float], Type[int], Type[complex], Type[bool], None] = None,
             copy: bool = False)

2. pd.series( ) function:

Series is a one-dimensional array, based on Numpy's ndarray structure

3.np.random.uniform(low=0.0high=1.0size=None)

  Function: randomly sample from a uniform distribution [low, high), note that the domain is left-closed and right-open, that is, low is included, and high is not included. Parameter introduction: low: sampling lower bound, float
type
, default value is 0;
high: Sampling upper bound, float type, the default value is 1;
size: the number of output samples, int or tuple type, for example, size=(m,n,k), then output mnk samples, output by default 1 value.
Return value: ndarray type, its shape is consistent with the description in parameter size.
The uniform() method will randomly generate the next real number in the range [x, y],

4. tk.geometry()

Tkinter is a Python module for developing GUI (Graphical User Interface) applications.

Tkinter provides many methods; one of them is the geometry() method. This method is used to set the size of the Tkinter window, which is used to set the position of the main window on the user's desktop.

5.python str( ) function:

The str() function converts an object into a human-readable form. That is, the object is in string format.

6. python def __init__(self): function

1. Python's def __init__(self): function

2.python's def __init__(self, parameter 1, parameter 2, parameter X)

1. It is possible to instantiate an empty object first

2. Must pass parameters when instantiating


class show1():
    def __init__(self, action):
        self.action = action

class show2():
    def __init__(self):
        self.action = None
if __name__ == '__main__':

    RL = show1( action=list(range(0,4)))

    RL2 = show2()
    RL2.action = [0,1,2,3]

7.canvas_widget.create_rectangle()

This function uses the tkinter package to draw a rectangle. The first four parameters in it are the upper left and lower right coordinates x1, y1, x2, y2. The latter parameters can also set the color of the rectangle, how to fill it, etc.

Guess you like

Origin blog.csdn.net/qq_42573052/article/details/121470702