os.path.splitext文件名与扩展名分离

from __future__ import absolute_import, division, print_function, unicode_literals
import os
import pandas as pd
import tensorflow as tf

zip_path = tf.keras.utils.get_file(
    origin='https://storage.googleapis.com/tensorflow/tf-keras-datasets/jena_climate_2009_2016.csv.zip',
    fname='jena_climate_2009_2016.csv.zip',
    extract=True)
csv_path, _ = os.path.splitext(zip_path)
# 分离文件名与扩展名
print(csv_path)
print(_)
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/jena_climate_2009_2016.csv.zip
13574144/13568290 [==============================] - 0s 0us/step
/root/.keras/datasets/jena_climate_2009_2016.csv
.zip

df = pd.read_csv(csv_path)
df.head()
 	Date Time 	p (mbar) 	T (degC) 	Tpot (K) 	Tdew (degC) 	rh (%) 	VPmax (mbar) 	VPact (mbar) 	VPdef (mbar) 	sh (g/kg) 	H2OC (mmol/mol) 	rho (g/m**3) 	wv (m/s) 	max. wv (m/s) 	wd (deg)
0 	01.01.2009 00:10:00 	996.52 	-8.02 	265.40 	-8.90 	93.3 	3.33 	3.11 	0.22 	1.94 	3.12 	1307.75 	1.03 	1.75 	152.3
1 	01.01.2009 00:20:00 	996.57 	-8.41 	265.01 	-9.28 	93.4 	3.23 	3.02 	0.21 	1.89 	3.03 	1309.80 	0.72 	1.50 	136.1
2 	01.01.2009 00:30:00 	996.53 	-8.51 	264.91 	-9.31 	93.9 	3.21 	3.01 	0.20 	1.88 	3.02 	1310.24 	0.19 	0.63 	171.6
3 	01.01.2009 00:40:00 	996.51 	-8.31 	265.12 	-9.07 	94.2 	3.26 	3.07 	0.19 	1.92 	3.08 	1309.19 	0.34 	0.50 	198.0
4 	01.01.2009 00:50:00 	996.51 	-8.27 	265.15 	-9.04 	94.1 	3.27 	3.08 	0.19 	1.92 	3.09 	1309.00 	0.32 	0.63 	214.3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值