ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

Python打卡第27天

2026/9/26 1:29:52 拓冰建站 浏览量
Python打卡第27天 浙大疏锦行0102030405060708091011121314151617# 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, heres several helpful packages to loadimportnumpy as np# linear algebraimportpandas 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 ShiftEnter) will list all files under the input directoryimportosfordirname, _, filenamesinos.walk(/kaggle/input):forfilenameinfilenames: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 wont be saved outside of the current session这是 Kaggle 在线笔记本默认生成的初始化代码主要作用是导入数据分析基础库并查看数据集文件。numpy用于数值计算pandas用来处理表格数据os.walk遍历/kaggle/input数据集目录打印出所有数据文件完整路径用来确认数据集已经上传加载成功。注释同时说明了 Kaggle 的文件规则/kaggle/working目录可保存输出文件临时目录/kaggle/temp会话结束后数据会丢失。这段代码不做数据建模、预测仅为项目前期环境与文件检查。