hdf5

R hdf5 dataset written incorrectly?

最后都变了- 提交于 2019-12-07 08:01:05
问题 When I execute the following my "predictors" dataset is populated correctly: library(rhdf5) library(forecast) library(sltl) library(tseries) fid <- H5Fcreate(output_file) ## TODO: compute the order p p <- 4 # write predictors h5createDataset(output_file, dataset="predictors", c(p, length(tsstl.remainder) - (p - 1)), storage.mode='double') predictors <- as.matrix(tsstl.remainder) for (i in 1:(p - 1)) { predictors <- as.matrix(cbind(predictors, Lag(as.matrix(tsstl.remainder), i))) } predictors

How can I load a data frame saved in pandas as an HDF5 file in R?

泄露秘密 提交于 2019-12-07 06:22:51
问题 I saved a data frame in pandas in an HDF5 file: import numpy as np import pandas as pd np.random.seed(1) frame = pd.DataFrame(np.random.randn(4, 3), columns=list('bde'), index=['Utah', 'Ohio', 'Texas', 'Oregon']) print('frame: {0}'.format(frame)) store = pd.HDFStore('file.h5') store['df'] = frame store.close() The frame looks as follows: frame: b d e Utah 1.624345 -0.611756 -0.528172 Ohio -1.072969 0.865408 -2.301539 Texas 1.744812 -0.761207 0.319039 Oregon -0.249370 1.462108 -2.060141 I am

Pandas, large data, HDF tables and memory usage when calling a function

若如初见. 提交于 2019-12-07 05:54:16
问题 Short question When Pandas work on a HDFStore (eg: .mean() or .apply() ), does it load the full data in memory as a DataFrame, or does it process record-by-record as a Serie? Long description I have to work on large data files, and I can specify the output format of the data file. I intend to use Pandas to process the data, and I would like to setup the best format so that it maximizes the performances. I have seen that panda.read_table() has gone a long way, but it still at least takes at

how to read Mat v7.3 files in python ?

风格不统一 提交于 2019-12-07 05:43:56
问题 I am trying to read the mat file given in the following website, ufldl.stanford.edu/housenumbers, in the file train.tar.gz, there is a mat file named digitStruct.mat. when i used scipy.io to read the mat file, it alerts me with the message ' please use hdf reader for matlab v7.3 files '. the original matlab file is provided as below load digitStruct.mat for i = 1:length(digitStruct) im = imread([digitStruct(i).name]); for j = 1:length(digitStruct(i).bbox) [height, width] = size(im); aa = max

For python, install hdf5/netcdf4

守給你的承諾、 提交于 2019-12-07 02:17:24
问题 Doing this on a Linux Mint 17.1. When I try: pip install hdf5 I get the error "Could not find a version that satisfies the requirement hdf5 (from versions: ) No matching distribution found for hdf5" I'm trying in the long run to install netcdf4 but can't do that until I get hdf5 installed. Supposedly from when I was trying to do this last week, with netcdf4, I should be using the pip install netcdf4, err hdf5...at least maybe in the case of hdf5. If I try pip install h5py I get that the

Deleting hdf5 dataset using h5py

混江龙づ霸主 提交于 2019-12-06 18:45:09
问题 Is there any way to remove a dataset from an hdf5 file, preferably using h5py? Or alternatively, is it possible to overwrite a dataset while keeping the other datasets intact? To my understanding, h5py can read/write hdf5 files in 5 modes f = h5py.File("filename.hdf5",'mode') where mode can be r for read, r+ for read-write, a for read-write but creates a new file if it doesn't exist, w for write/overwrite, and w- which is same as w but fails if file already exists. I have tried all but none

Working with 10+GB dataset in Python Pandas

帅比萌擦擦* 提交于 2019-12-06 13:35:32
问题 I have a very large .csv (which originally came from a SAS dataset) that has the following columns: target_series metric_series month metric_1 metric_2 target_metric 1 1 1 #float #float #float 1 1 2 #float #float #float ... 1 1 60 #float #float #float 1 2 1 #float #float #float 1 2 2 #float #float #float ... 1 80000 60 #float #float #float 2 1 1 #float #float #float ... 50 80000 60 #float #float #float As you can see, the file has 60 months times 80000 independent series times 50 target

Python pandas Reading specific values from HDF5 files using read_hdf and HDFStore.select

我怕爱的太早我们不能终老 提交于 2019-12-06 12:13:07
问题 So I created hdf5 file with a simple dataset that looks like this >>> pd.read_hdf('STORAGE2.h5', 'table') A B 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 Using this script import pandas as pd import scipy as sp from pandas.io.pytables import Term store = pd.HDFStore('STORAGE2.h5') df_tl = pd.DataFrame(dict(A=list(range(5)), B=list(range(5)))) df_tl.to_hdf('STORAGE2.h5','table',append=True) I know I can select columns using x = pd.read_hdf('STORAGE2.h5', 'table', columns=['A']) or x = store.select('table',

Python - Fast HDF5 Time Series Data Queries

拈花ヽ惹草 提交于 2019-12-06 11:05:46
问题 I need to do a lot of successive queries on time series data in specific time spans from a HDF5 database (the data is stord in seconds, not always "continuous", I only know the start and end time). Therefore, I wonder wether there is a faster solution than my current code, which was inspired by this answer: import pandas as pd from pandas import HDFStore store = HDFStore(pathToStore) dates = pd.date_range(start=start_date,end=end_date, freq='S') index = store.select_column('XAU','index') ts =

Import huge data-set from SQL server to HDF5

好久不见. 提交于 2019-12-06 08:22:36
问题 I am trying to import ~12 Million records with 8 columns into Python.Because of its huge size my laptop memory would not be sufficient for this. Now I'm trying to import the SQL data into a HDF5 file format. It would be very helpful if someone can share a snippet of code that queries data from SQL and saves it in the HDF5 format in chunks.I am open to use any other file format that would be easier to use. I plan to do some basic exploratory analysis and later on might create some decision