Create my own method for DataFrames (python)
问题 So I wanted to create a module for my own projects and wanted to use methods. For example I wanted to do: from mymodule import * df = pd.DataFrame(np.random.randn(4,4)) df.mymethod() Thing is it seems I can't use .myfunc() since I think I can only use methods for the classes I've created. A work around is making mymethod a function and making it use pandas.Dataframes as a variable: myfunc(df) I don't really want to do this, is there anyway to implement the first one? 回答1: If you really need