Evan
2016-10-10 06:52:00 UTC
I am getting the following error after using `pandas.HDFStore().append()`
ValueError: Trying to store a string with len [150] in [values_block_0]
column but this column has a limit of [127]!
Consider using min_itemsize to preset the sizes on these columns
I am creating a pandas DataFrame and appending it to the HDF5 file as
follows:
import pandas as pd
store = pd.HDFStore("test1.h5", mode='w')
hdf_key = "one_key"
columns = ["col1", "col2", ... ]
df = pd.Dataframe(...)
df.col1 = df.col1.astype(str)
df.col2 = df.col2astype(int)
df.col3 = df.col3astype(str)
....
store.append(hdf_key, df, data_column=columns, index=False)
I get the error above: "ValueError: Trying to store a string with len [150]
in [values_block_0] column but this column has a limit of [127]!"
So, following this
StackOverflow http://stackoverflow.com/questions/22710738/pandas-pytable-how-to-specify-min-itemsize-of-the-elements-of-a-multiindex
, I tried
store.append(hdf_key, df, data_column=columns, index=False,
min_itemsize={"values_block_0":250})
This doesn't work though: I get this error:
ValueError: Trying to store a string with len [250] in [values_block_0]
column but this column has a limit of [127]!
Consider using min_itemsize to preset the sizes on these columns
What am I doing wrong?
ValueError: Trying to store a string with len [150] in [values_block_0]
column but this column has a limit of [127]!
Consider using min_itemsize to preset the sizes on these columns
I am creating a pandas DataFrame and appending it to the HDF5 file as
follows:
import pandas as pd
store = pd.HDFStore("test1.h5", mode='w')
hdf_key = "one_key"
columns = ["col1", "col2", ... ]
df = pd.Dataframe(...)
df.col1 = df.col1.astype(str)
df.col2 = df.col2astype(int)
df.col3 = df.col3astype(str)
....
store.append(hdf_key, df, data_column=columns, index=False)
I get the error above: "ValueError: Trying to store a string with len [150]
in [values_block_0] column but this column has a limit of [127]!"
So, following this
StackOverflow http://stackoverflow.com/questions/22710738/pandas-pytable-how-to-specify-min-itemsize-of-the-elements-of-a-multiindex
, I tried
store.append(hdf_key, df, data_column=columns, index=False,
min_itemsize={"values_block_0":250})
This doesn't work though: I get this error:
ValueError: Trying to store a string with len [250] in [values_block_0]
column but this column has a limit of [127]!
Consider using min_itemsize to preset the sizes on these columns
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.