How to unzip gz file using Python
How to unzip gz file using Python
import gzip
import shutil
with gzip.open(file.txt.gz, rb) as f_in:
with open(file.txt, wb) as f_out:
shutil.copyfileobj(f_in, f_out)
import gzip
with gzip.open(file.txt.gz, rb) as f:
file_content = f.read()
How to unzip gz file using Python
Maybe you want pass it to pandas also.
with gzip.open(features_train.csv.gz) as f:
features_train = pd.read_csv(f)
features_train.head()