1. What is the difference in meaning between Python modules and libraries?
2. In scikitlearn, from sklearn.model_selection import train_test_split
Read the train_test_split function by writing , but in pandas, from pandas import read_csv
Read the read_cav function by writing .Both scikitlearn and pandas seem to be libraries, but why is train_test_split two tiers below skitlearn and read_csv one tier below pandas?I thought library モジュール module 関数 function, but is it different?
Please answer the above two questions.
python
1.
modules:a collection of definitions of modules, functions, classes, variables, etc.
libraries:a collection of definitions of modules, functions, classes, variables, etc.
The word library is not specified in Python's language specification.It is used in a very large area.C's standard library or C#'s .net class library.A library is a generic program (API) written primarily for the purpose of being called by a programmer.
The module is designated as the Python language specification, so this one has a clearer meaning.Functions and classes are included.A module containing multiple modules is sometimes called a package in python, but internally it seems to be a module that organizes multiple files (modules).
2.
In this case, sklearn is a package, or a hierarchical module.
Pandas is a module with read_csv downstairs.
Both modules and modules are allowed.
import sklearn
import pandas
Type(sklearn)#->module but often referred to as a package
type(sklearn.model_selection)#->module
type(pandas)#->module
type(train_test_split)#->function
© 2024 OneMinuteCode. All rights reserved.