Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory
import os
for dirname, _, filenames in os.walk('/kaggle/input'):
for filename in filenames:
print(os.path.join(dirname, filename))
# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All"
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
/kaggle/input/mobile-price-classification/train.csv
/kaggle/input/mobile-price-classification/test.csv
pip install lightgbm==3.*
Requirement already satisfied: lightgbm==3.* in /opt/conda/lib/python3.7/site-packages (3.0.0)
Requirement already satisfied: scikit-learn!=0.22.0 in /opt/conda/lib/python3.7/site-packages (from lightgbm==3.*) (0.23.2)
Requirement already satisfied: scipy in /opt/conda/lib/python3.7/site-packages (from lightgbm==3.*) (1.4.1)
Requirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from lightgbm==3.*) (1.18.5)
Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/conda/lib/python3.7/site-packages (from scikit-learn!=0.22.0->lightgbm==3.*) (2.1.0)
Requirement already satisfied: joblib>=0.11 in /opt/conda/lib/python3.7/site-packages (from scikit-learn!=0.22.0->lightgbm==3.*) (0.14.1)
Note: you may need to restart the kernel to use updated packages.
pip list
Package Version Location
---------------------------------- ------------------- --------------
absl-py 0.11.0
adal 1.2.2
affine 2.3.0
aiobotocore 1.1.2
aiohttp 3.7.2
aiohttp-cors 0.7.0
aioitertools 0.7.0
aioredis 1.3.1
alabaster 0.7.12
albumentations 0.5.0
alembic 1.4.3
allennlp 1.2.0
altair 4.1.0
anaconda-client 1.7.2
anaconda-project 0.8.3
annoy 1.17.0
ansiwrap 0.8.4
appdirs 1.4.3
argh 0.26.2
arrow 0.15.5
arviz 0.10.0
asn1crypto 1.3.0
astroid 2.3.3
astropy 4.0.1.post1
astunparse 1.6.3
async-generator 1.10
async-timeout 3.0.1
atomicwrites 1.3.0
attrs 19.3.0
audioread 2.1.9
autopep8 1.5.1
Babel 2.8.0
backcall 0.1.0
backports.shutil-get-terminal-size 1.0.0
Baker 1.3
basemap 1.2.1
bayesian-optimization 1.2.0
bayespy 0.5.20
bcolz 1.2.1
beautifulsoup4 4.9.0
binaryornot 0.4.4
biopython 1.78
bitarray 1.2.1
bkcharts 0.2
black 19.10b0
bleach 3.1.4
blessings 1.7
blinker 1.4
blis 0.4.1
bokeh 2.2.3
Boruta 0.3
boto 2.49.0
boto3 1.16.8
botocore 1.19.8
Bottleneck 1.3.2
bq-helper 0.4.1 /src/bq-helper
bqplot 0.12.18
branca 0.4.1
brewer2mpl 1.4.1
brotlipy 0.7.0
cachetools 3.1.1
cairocffi 1.2.0
CairoSVG 2.5.0
Cartopy 0.18.0
catalogue 1.0.0
catalyst 20.10.1
catboost 0.24.2
category-encoders 2.2.2
certifi 2020.6.20
cesium 0.9.12
cffi 1.14.0
cftime 1.2.1
chainer 7.7.0
chainer-chemistry 0.7.1
chainercv 0.13.1
chardet 3.0.4
cleverhans 3.0.1
click 7.1.1
click-plugins 1.1.1
cliff 3.4.0
cligj 0.7.0
cloud-tpu-client 0.10
cloudpickle 1.3.0
clyent 1.2.2
cmaes 0.7.0
cmd2 1.3.11
cmdstanpy 0.9.5
cmudict 0.4.5
colorama 0.4.3
colorcet 2.0.2
colorful 0.5.4
colorlog 4.4.0
colorlover 0.3.0
conda 4.9.0
conda-package-handling 1.6.0
ConfigArgParse 1.2.3
configparser 5.0.1
confuse 1.1.0
contextily 1.0.1
contextlib2 0.6.0.post1
convertdate 2.2.2
conx 3.7.10
cookiecutter 1.7.0
coverage 5.3
cryptography 2.8
cssselect2 0.4.1
cufflinks 0.17.3
CVXcanon 0.1.2
cvxpy 1.1.7
cycler 0.10.0
cymem 2.0.3
cysignals 1.10.2
Cython 0.29.21
cytoolz 0.10.1
dask 2.30.0
dask-glm 0.2.0
dask-ml 1.7.0
dask-xgboost 0.1.11
datashader 0.11.1
datashape 0.5.2
deap 1.3.1
decorator 4.4.2
deepdish 0.3.6
defusedxml 0.6.0
Delorean 1.0.0
Deprecated 1.2.10
deprecation 2.1.0
descartes 1.1.0
diff-match-patch 20181111
dill 0.3.2
dipy 1.2.0
distributed 2.14.0
dlib 19.21.0
dm-tree 0.1.5
docker 4.2.0
docker-pycreds 0.4.0
docopt 0.6.2
docutils 0.15.2
earthengine-api 0.1.240
easydev 0.10.1
ecos 2.0.7.post1
eli5 0.10.1
emoji 0.6.0
en-core-web-lg 2.3.1
en-core-web-sm 2.3.1
entrypoints 0.3
ephem 3.7.7.1
essentia 2.1b6.dev234
et-xmlfile 1.0.1
fancyimpute 0.5.5
fastai 2.0.18
fastcache 1.1.0
fastcore 1.2.5
fastprogress 1.0.0
fasttext 0.9.2
fbpca 1.0
fbprophet 0.7.1
feather-format 0.4.1
featuretools 0.20.0
filelock 3.0.10
Fiona 1.8.17
fitter 1.3.0
flake8 3.7.9
flashtext 2.7
Flask 1.1.2
folium 0.11.0
fsspec 0.8.4
funcy 1.15
fury 0.6.1
future 0.18.2
fuzzywuzzy 0.18.0
gast 0.3.3
gatspy 0.3
gcsfs 0.6.1
GDAL 3.1.2
gensim 3.8.3
geographiclib 1.50
Geohash 1.0
geojson 2.5.0
geopandas 0.8.1
geoplot 0.4.1
geopy 2.0.0
geoviews 1.8.1
gevent 1.5.0
ggplot 0.11.5
gitdb 4.0.4
GitPython 3.1.1
glob2 0.7
gluoncv 0.8.0
gluonnlp 0.10.0
gmpy2 2.1.0b1
google 3.0.0
google-api-core 1.23.0
google-api-python-client 1.8.0
google-auth 1.14.0
google-auth-httplib2 0.0.3
google-auth-oauthlib 0.4.1
google-cloud-automl 1.0.1
google-cloud-bigquery 1.12.1
google-cloud-bigtable 1.2.1
google-cloud-core 1.3.0
google-cloud-dataproc 0.7.0
google-cloud-datastore 1.12.0
google-cloud-firestore 1.6.2
google-cloud-kms 1.4.0
google-cloud-language 1.3.0
google-cloud-logging 1.15.0
google-cloud-pubsub 1.4.3
google-cloud-scheduler 1.2.1
google-cloud-spanner 1.15.1
google-cloud-speech 1.3.2
google-cloud-storage 1.27.0
google-cloud-tasks 1.5.0
google-cloud-translate 2.0.1
google-cloud-videointelligence 1.14.0
google-cloud-vision 1.0.0
google-pasta 0.2.0
google-resumable-media 0.5.0
googleapis-common-protos 1.52.0
gplearn 0.4.1
gpustat 0.6.0
gpxpy 1.4.2
graphviz 0.8.4
greenlet 0.4.15
grpc-google-iam-v1 0.12.3
grpcio 1.33.2
grpcio-gcp 0.2.2
gym 0.17.3
h2o 3.30.1.3
h5py 2.10.0
haversine 2.3.0
heamy 0.0.7
HeapDict 1.0.1
hep-ml 0.6.1
hiredis 1.1.0
hmmlearn 0.2.4
holidays 0.10.3
holoviews 1.13.5
hpsklearn 0.1.0
html5lib 1.0.1
htmlmin 0.1.12
httplib2 0.17.2
httplib2shim 0.0.3
humanize 3.1.0
hunspell 0.5.5
husl 4.0.3
hyperopt 0.2.5
hypertools 0.6.3
hypothesis 5.10.0
ibis-framework 1.3.0
idna 2.9
imagecodecs 2020.5.30
ImageHash 4.1.0
imageio 2.8.0
imagesize 1.2.0
imbalanced-learn 0.7.0
imgaug 0.4.0
implicit 0.4.4
importlib-metadata 2.0.0
importlib-resources 3.3.0
intervaltree 3.0.2
ipykernel 5.1.1
ipython 7.13.0
ipython-genutils 0.2.0
ipython-sql 0.3.9
ipywidgets 7.5.1
iso3166 1.0.1
isort 4.3.21
isoweek 1.3.3
itsdangerous 1.1.0
Janome 0.4.1
jdcal 1.4.1
jedi 0.15.2
jeepney 0.4.3
jieba 0.42.1
Jinja2 2.11.2
jinja2-time 0.2.0
jmespath 0.10.0
joblib 0.14.1
jovian 0.2.26
json5 0.9.0
jsonnet 0.16.0
jsonpickle 1.4.1
jsonschema 3.2.0
jupyter 1.0.0
jupyter-aihub-deploy-extension 0.1
jupyter-client 6.1.3
jupyter-console 6.1.0
jupyter-core 4.6.3
jupyter-http-over-ws 0.0.8
jupyterlab 1.2.10
jupyterlab-git 0.10.0
jupyterlab-server 1.1.1
kaggle 1.5.9
kaggle-environments 1.3.14
Keras 2.4.3
Keras-Preprocessing 1.1.2
keras-tuner 1.0.1
keyring 21.1.1
kiwisolver 1.2.0
kmapper 1.4.1
kmeans-smote 0.1.2
kmodes 0.10.2
knnimpute 0.1.0
korean-lunar-calendar 0.2.1
kornia 0.4.1
kubernetes 10.1.0
langid 1.1.6
Lasagne 0.2.dev1
lazy-object-proxy 1.4.3
learntools 0.3.4
leven 1.0.4
libarchive-c 2.9
librosa 0.8.0
lief 0.9.0
lightfm 1.15
lightgbm 3.0.0
lime 0.2.0.1
line-profiler 3.0.2
llvmlite 0.31.0
lml 0.1.0
locket 0.2.0
LunarCalendar 0.0.9
lxml 4.5.0
Mako 1.1.3
mapclassify 2.3.0
marisa-trie 0.7.5
Markdown 3.2.1
markovify 0.8.3
MarkupSafe 1.1.1
matplotlib 3.2.1
matplotlib-venn 0.11.6
mccabe 0.6.1
memory-profiler 0.58.0
mercantile 1.1.6
missingno 0.4.2
mistune 0.8.4
mizani 0.7.2
mkl-fft 1.1.0
mkl-random 1.1.0
mkl-service 2.3.0
ml-metrics 0.1.4
mlcrate 0.2.0
mlens 0.2.3
mlxtend 0.17.3
mmh3 2.5.1
mne 0.21.0
mnist 0.2.2
mock 3.0.5
more-itertools 8.2.0
mpld3 0.5.1
mplleaflet 0.0.5
mpmath 1.1.0
msgpack 1.0.0
msgpack-numpy 0.4.7.1
multidict 5.0.0
multipledispatch 0.6.0
multiprocess 0.70.10
munch 2.5.0
murmurhash 1.0.2
mxnet 1.7.0.post1
mypy-extensions 0.4.3
nb-conda 2.2.1
nb-conda-kernels 2.2.3
nbclient 0.2.0
nbconvert 5.6.1
nbdime 2.0.0
nbformat 5.0.6
nbpresent 3.0.2
nervananeon 2.6.0
nest-asyncio 1.3.2
netCDF4 1.5.4
networkx 2.4
nibabel 3.2.0
nilearn 0.6.2
nltk 3.2.4
nnabla 1.12.0
nolearn 0.6.1
nose 1.3.7
notebook 5.5.0
notebook-executor 0.2
numba 0.48.0
numexpr 2.7.1
numpy 1.18.5
numpydoc 0.9.2
nvidia-ml-py3 7.352.0
oauth2client 4.1.3
oauthlib 3.0.1
odfpy 1.4.1
olefile 0.46
onnx 1.7.0
opencensus 0.7.11
opencensus-context 0.1.2
opencv-python 4.4.0.44
opencv-python-headless 4.4.0.44
openpyxl 3.0.3
openslide-python 1.1.1
opt-einsum 3.3.0
optuna 2.2.0
orderedmultidict 1.0.1
ortools 8.0.8283
osmnx 0.15.1
osqp 0.6.1
overrides 3.1.0
OWSLib 0.20.0
packaging 20.1
palettable 3.3.0
pandas 1.1.3
pandas-datareader 0.9.0
pandas-profiling 2.6.0
pandas-summary 0.0.7
pandasql 0.7.3
pandoc 1.0.2
pandocfilters 1.4.2
panel 0.10.1
papermill 2.1.0
param 1.10.0
parso 0.5.2
partd 1.1.0
path 13.1.0
path.py 12.5.0
pathlib2 2.3.5
pathos 0.2.6
pathspec 0.8.0
pathtools 0.1.2
patsy 0.5.1
pbr 5.5.1
pdf2image 1.14.0
PDPbox 0.2.0+13.g73c6966
pep8 1.7.1
pexpect 4.8.0
phik 0.9.11
pickleshare 0.7.5
Pillow 8.0.1
pip 20.2.4
pkginfo 1.5.0.1
plac 1.1.3
plotly 4.12.0
plotly-express 0.4.1
plotnine 0.7.1
pluggy 0.13.0
ply 3.11
polyglot 16.7.4
pooch 1.2.0
portalocker 2.0.0
posix-ipc 1.0.5
pox 0.2.8
poyo 0.5.0
ppca 0.0.4
ppft 1.6.6.2
preprocessing 0.1.13
preshed 3.0.2
prettytable 0.7.2
prometheus-client 0.7.1
promise 2.3
prompt-toolkit 3.0.5
pronouncing 0.2.0
protobuf 3.13.0
psutil 5.7.0
ptyprocess 0.6.0
pudb 2019.2
py 1.8.1
py-cpuinfo 7.0.0
py-lz4framed 0.14.0
py-spy 0.3.3
py-stringmatching 0.4.2
py-stringsimjoin 0.3.2
pyahocorasick 1.4.0
pyaml 20.4.0
PyArabic 0.6.10
pyarrow 0.16.0
pyasn1 0.4.8
pyasn1-modules 0.2.7
PyAstronomy 0.15.2
pybind11 2.6.0
PyBrain 0.3
pycairo 1.20.0
pycodestyle 2.5.0
pycosat 0.6.3
pycountry 20.7.3
pycparser 2.20
pycrypto 2.6.1
pyct 0.4.6
pycurl 7.43.0.5
pydash 4.9.0
pydegensac 0.1.2
pydicom 2.0.0
pydocstyle 5.0.2
pydot 1.4.1
pydub 0.24.1
pyemd 0.5.1
pyepsg 0.4.0
pyexcel-io 0.6.3
pyexcel-ods 0.6.0
pyfasttext 0.4.6
pyflakes 2.1.1
pyglet 1.5.0
Pygments 2.6.1
PyJWT 1.7.1
pykalman 0.9.5
pyLDAvis 2.1.2
pylint 2.4.4
pymc3 3.9.3
PyMeeus 0.3.7
pymongo 3.11.0
Pympler 0.9
pyocr 0.7.2
pyodbc 4.0.30
pyOpenSSL 19.1.0
pypandoc 1.5
pyparsing 2.4.7
pyPdf 1.13
pyperclip 1.8.1
PyPrind 2.11.2
pyproj 2.6.1.post1
PyQt5 5.12.3
PyQt5-sip 4.19.18
PyQtWebEngine 5.12.1
pyrsistent 0.16.0
pysal 2.1.0
pyshp 2.1.2
PySocks 1.7.1
pystan 2.19.1.1
pytagcloud 0.3.5
pytesseract 0.3.6
pytest 5.4.1
pytest-arraydiff 0.3
pytest-astropy 0.7.0
pytest-astropy-header 0.1.2
pytest-cov 2.10.1
pytest-doctestplus 0.4.0
pytest-mock 3.3.1
pytest-openfiles 0.4.0
pytest-remotedata 0.3.1
pytext-nlp 0.1.2
python-dateutil 2.8.1
python-editor 1.0.4
python-igraph 0.8.2
python-jsonrpc-server 0.3.4
python-language-server 0.31.10
python-Levenshtein 0.12.0
python-louvain 0.14
python-slugify 4.0.1
pytorch-ignite 0.4.2
pytorch-lightning 1.0.4
pytz 2019.3
PyUpSet 0.1.1.post7
pyviz-comms 0.7.6
PyWavelets 1.1.1
pyxdg 0.26
PyYAML 5.3.1
pyzmq 19.0.0
QDarkStyle 2.8.1
qgrid 1.3.1
QtAwesome 0.7.1
qtconsole 4.7.3
QtPy 1.9.0
randomgen 1.16.6
rasterio 1.1.8
ray 1.0.0
redis 3.4.1
regex 2020.4.4
requests 2.23.0
requests-oauthlib 1.2.0
resampy 0.2.2
retrying 1.3.3
rgf-python 3.9.0
rope 0.16.0
rsa 4.0
Rtree 0.9.4
ruamel-yaml 0.15.80
s2sphere 0.2.5
s3fs 0.5.1
s3transfer 0.3.3
sacred 0.8.1
sacremoses 0.0.43
scattertext 0.0.2.71
scikit-image 0.16.2
scikit-learn 0.23.2
scikit-multilearn 0.2.0
scikit-optimize 0.8.1
scikit-plot 0.3.7
scikit-surprise 1.1.1
scipy 1.4.1
scs 2.1.2
seaborn 0.10.0
SecretStorage 3.1.2
Send2Trash 1.5.0
sentencepiece 0.1.94
sentry-sdk 0.19.1
setuptools 46.1.3.post20200325
setuptools-git 1.2
shap 0.36.0
Shapely 1.7.1
shortuuid 1.0.1
simplegeneric 0.8.1
SimpleITK 2.0.1
simplejson 3.17.0
singledispatch 3.4.0.3
sip 4.19.20
six 1.14.0
sklearn 0.0
sklearn-contrib-py-earth 0.1.0+1.gdde5f89
sklearn-pandas 2.0.2
slicer 0.0.4
slugify 0.0.1
smart-open 3.0.0
smhasher 0.150.1
smmap 3.0.2
snowballstemmer 2.0.0
snuggs 1.4.7
sortedcollections 1.1.2
sortedcontainers 2.1.0
SoundFile 0.10.3.post1
soupsieve 1.9.4
spacy 2.3.2
spectral 0.22.1
Sphinx 3.0.2
sphinx-rtd-theme 0.2.4
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 1.0.3
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.4
sphinxcontrib-websupport 1.2.1
spyder 4.1.2
spyder-kernels 1.9.0
SQLAlchemy 1.3.16
sqlparse 0.3.1
squarify 0.4.3
srsly 1.0.2
statsmodels 0.11.1
stemming 1.0.1
stevedore 3.2.2
stop-words 2018.7.23
stopit 1.1.2
subprocess32 3.5.4
svgwrite 1.4
sympy 1.5.1
tables 3.6.1
tabulate 0.8.7
tangled-up-in-unicode 0.0.4
tblib 1.6.0
tenacity 6.1.0
tensorboard 2.3.0
tensorboard-plugin-wit 1.7.0
tensorboardX 2.1
tensorflow 2.3.1
tensorflow-addons 0.10.0
tensorflow-datasets 4.0.1
tensorflow-estimator 2.3.0
tensorflow-gcs-config 2.1.7
tensorflow-hub 0.10.0
tensorflow-metadata 0.24.0
tensorflow-probability 0.11.1
Tensorforce 0.5.5
tensorpack 0.10.1
termcolor 1.1.0
terminado 0.8.3
terminalplot 0.3.0
terminaltables 3.1.0
testpath 0.4.4
text-unidecode 1.3
textblob 0.15.3
texttable 1.6.3
textwrap3 0.9.2
Theano 1.0.5
thinc 7.4.1
threadpoolctl 2.1.0
tifffile 2020.10.1
tinycss2 1.1.0
tokenizers 0.9.2
toml 0.10.0
toolz 0.10.0
torch 1.6.0
torchaudio 0.6.0a0+f17ae39
torchtext 0.8.0a0+c851c3e
torchvision 0.7.0
tornado 5.0.2
TPOT 0.11.6
tqdm 4.45.0
traitlets 4.3.3
traittypes 0.2.1
transformers 3.4.0
trueskill 0.4.5
tsfresh 0.17.0
typed-ast 1.4.1
typeguard 2.10.0
typing 3.7.4.3
typing-extensions 3.7.4.1
tzlocal 2.1
ujson 1.35
umap-learn 0.4.6
unicodecsv 0.14.1
Unidecode 1.1.1
update-checker 0.18.0
uritemplate 3.0.1
urllib3 1.25.9
urwid 2.1.2
uuid 1.30
vecstack 0.4.0
visions 0.4.1
vowpalwabbit 8.8.1
vtk 9.0.1
Wand 0.5.3
wandb 0.10.8
wasabi 0.8.0
watchdog 0.10.2
wavio 0.0.4
wcwidth 0.1.9
webencodings 0.5.1
websocket-client 0.57.0
Werkzeug 1.0.1
wfdb 3.1.1
wheel 0.34.2
whichcraft 0.6.1
widgetsnbextension 3.5.1
Wordbatch 1.4.6
wordcloud 1.8.0
wordsegment 1.3.1
wrapt 1.11.2
wurlitzer 2.0.0
xarray 0.16.1
xgboost 1.2.1
xlrd 1.2.0
XlsxWriter 1.2.8
xlwt 1.3.0
xvfbwrapper 0.2.9
yapf 0.29.0
yarl 1.6.2
yellowbrick 1.2
zict 2.0.0
zipp 3.1.0
Note: you may need to restart the kernel to use updated packages.
import lightgbm as lgm
train = pd.read_csv("/kaggle/input/mobile-price-classification/train.csv")
test = pd.read_csv("/kaggle/input/mobile-price-classification/test.csv")
train['binary_price_range'] = 0
train.loc[(
train['price_range'].isin([2,3]),
"binary_price_range"
)] = 1
X = train[['battery_power', 'blue', 'clock_speed', 'dual_sim', 'fc', 'four_g',
'int_memory', 'm_dep', 'mobile_wt', 'n_cores', 'pc', 'px_height',
'px_width', 'ram', 'sc_h', 'sc_w', 'talk_time', 'three_g',
'touch_screen', 'wifi',]]
y = train[["binary_price_range"]]
X_train = lgm.Dataset(X, y)
parameters = {
"n_estimators": 3,
"max_depth":3,
"random_state": 43
}
basic_model = lgm.train(parameters,train_set = X_train)
X['PRED'] = basic_model.predict(X)
df_trees = basic_model.trees_to_dataframe()
[LightGBM] [Warning] Auto-choosing col-wise multi-threading, the overhead of testing was 0.000664 seconds.
You can set `force_col_wise=true` to remove the overhead.
[LightGBM] [Info] Total Bins 1361
[LightGBM] [Info] Number of data points in the train set: 2000, number of used features: 20
[LightGBM] [Info] Start training from score 0.500000
/opt/conda/lib/python3.7/site-packages/lightgbm/engine.py:151: UserWarning: Found `n_estimators` in params. Will use it instead of argument
warnings.warn("Found `{}` in params. Will use it instead of argument".format(alias))
/opt/conda/lib/python3.7/site-packages/ipykernel_launcher.py:25: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df_trees