Today is my 67th day of #100daysofcode and #python learning. Today I learned introduction to importing data in python. Gain knowledge of importing different data file like flat file, csv file, file from other software, relational database, excel spreadsheets, MATLAB files, SAS file, stata file, HDF5 file, pickled file. Here is one code to extracting data from hdf5 file.
Code
I got concept of HDF5 are
- Hierarchical Data format version 5
- Standard for sorting large quantities of numerical data
- Datasets can be hundred of gigabytes of terabytes
- HDF5 can scale to exabytes
# Get the HDF5 group: group
group = data['strain']
# Check out keys of group
for key in group.keys():
print(key)
# Set variable equal to time series data: strain
strain = data['strain']['Strain'].value
# Set number of time points to sample: num_samples
num_samples = 10000
# Set time vector
time = np.arange(0, 1, 1/num_samples)
# Plot data
plt.plot(time, strain[:num_samples])
plt.xlabel('GPS Time (s)')
plt.ylabel('strain')
plt.show()
Day 67 Of #100DaysOfCode and #python
— Durga Pokharel (@mathdurga) March 5, 2021
Extracting data from HDF5 file From https://t.co/Y3LozYIWOkDatacamp#WomenWhoCode #100DaysOfCode #CodeNewbies #DEVCommunity #womenintech pic.twitter.com/w7M0Y8AZNV
Top comments (0)