Python - how to store time series into dataset

user1518183

I build a parser which converts MIDI song into sequence of note - chord tuples. For each song, it returns list of tuples, where first item is note and second item is set of notes. So resulting data has shape [(note, {chords})], e.g. [(20, {21, 23}), (30, {22, 24, 26, 28})]. Notice that chord could be arbitrary long.

I would like to build a dataset from many songs and later pass them into recurrent neural network. So my question is: What is simplest way to persist this data into file?

I tried h5py library. Unfortunately, it only works with matrices. Though it would be possible to save each pair like that, it would probably be very inefficient, since length of chord is unlimited.

Demetri Pananos

Pickle it.

#Write
import pickle 
x = [(20, {21, 23}), (30, {22, 24, 26, 28})]

with open('pickle.txt','wb') as f:
    pickle.dump(x,f)

#Read
with open('pickle.txt','rb') as f:
    y = pickle.load(f)

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to calculate SMAPE for groups in time-series data in python?

分類Dev

How to join time series data in python with differing headings?

分類Dev

How to build an LSTM time-series forecasting model in python?

分類Dev

How to efficiently map data between time series in python

分類Dev

Fast way to localize time in python for large dataset?

分類Dev

how to define the lastest time of publication for a time series

分類Dev

Plotting time series with multicolor line in Python

分類Dev

Vectorized subsetting of time-series in Python

分類Dev

python pandas time series select day of year

分類Dev

How to divide a dataset into partitions and store different attributs of a specific function?

分類Dev

SparkSQL on pyspark: how to generate time series?

分類Dev

How to average time series by groups in R

分類Dev

How to remove inconsistencies from dataframe (time series)

分類Dev

How to make a custom sklearn transformer for time series?

分類Dev

How to remove seasonality from time series data?

分類Dev

How to generate all permutations of a time series?

分類Dev

How can i make python take a data time in format hh:mm:ss and store it in an array?

分類Dev

How to store the several time periods into MySQL table?

分類Dev

How to store second (time) as a constant on ios?

分類Dev

how to calculate mutual information of entire dataset in python

分類Dev

convert irregular time series to hourly data in python and have normal distribution

分類Dev

Python pandas: insert rows for missing dates, time series in groupby dataframe

分類Dev

How to measure time in Python?

分類Dev

How to train a RNN with LSTM cells for time series prediction

分類Dev

R: How to get the maximum value of a datetime column in a time series data

分類Dev

How to convert to a time series and plot a dataframe with each day as a variable or column?

分類Dev

How to convert to a time series and plot a dataframe with each day as a variable or column?

分類Dev

How to remove repeated samples from a time series in Pandas?

分類Dev

How to create stacked bar chart with a time series and aggregated values

Related 関連記事

  1. 1

    How to calculate SMAPE for groups in time-series data in python?

  2. 2

    How to join time series data in python with differing headings?

  3. 3

    How to build an LSTM time-series forecasting model in python?

  4. 4

    How to efficiently map data between time series in python

  5. 5

    Fast way to localize time in python for large dataset?

  6. 6

    how to define the lastest time of publication for a time series

  7. 7

    Plotting time series with multicolor line in Python

  8. 8

    Vectorized subsetting of time-series in Python

  9. 9

    python pandas time series select day of year

  10. 10

    How to divide a dataset into partitions and store different attributs of a specific function?

  11. 11

    SparkSQL on pyspark: how to generate time series?

  12. 12

    How to average time series by groups in R

  13. 13

    How to remove inconsistencies from dataframe (time series)

  14. 14

    How to make a custom sklearn transformer for time series?

  15. 15

    How to remove seasonality from time series data?

  16. 16

    How to generate all permutations of a time series?

  17. 17

    How can i make python take a data time in format hh:mm:ss and store it in an array?

  18. 18

    How to store the several time periods into MySQL table?

  19. 19

    How to store second (time) as a constant on ios?

  20. 20

    how to calculate mutual information of entire dataset in python

  21. 21

    convert irregular time series to hourly data in python and have normal distribution

  22. 22

    Python pandas: insert rows for missing dates, time series in groupby dataframe

  23. 23

    How to measure time in Python?

  24. 24

    How to train a RNN with LSTM cells for time series prediction

  25. 25

    R: How to get the maximum value of a datetime column in a time series data

  26. 26

    How to convert to a time series and plot a dataframe with each day as a variable or column?

  27. 27

    How to convert to a time series and plot a dataframe with each day as a variable or column?

  28. 28

    How to remove repeated samples from a time series in Pandas?

  29. 29

    How to create stacked bar chart with a time series and aggregated values

ホットタグ

アーカイブ