Variables repeating when adding metadata

  • MNE version: e.g. 1.8.0.dev141+g6da505591
  • operating system: Windows 10

Hello,

When adding metadata to an epochs object, I am encountering something rather odd. Say I have the following pandas dataframe:

Stim
face
object
face

I append this dataframe to the epochs object like so:


new_metadata = pd.DataFrame(
    data=(behavdata)*len(myeegdata), columns=["stim"], index=range(len(myeegdata))
)
myeegdata.metadata = new_metadata
myeegdata.metadata.head()

It attaches as metadata, but with one weird caveat. When I examine the metadata, the output looks like this:

1      facefacefacefacefacefacefacefacefacefacefacefa...
2      objectobjectobjectobjectobjectobjectobjectobject...
3      facefacefacefacefacefacefacefacefacefacefacefa...

Is there a way I can get the variables to stop repeating this way? Thank you very much!

Hello @the_plague.doctor and welcome to the forum!

Have you checked what new_metadata looks like before attaching it to the epochs?

Richard

Answering my own question here. I had to edit my code in the following way to get it to work:

new_metadata = pd.DataFrame(
    data=(behavdata), columns=["stim"], index=range(len(myeegdata))
)
myeegdata.metadata = new_metadata
myeegdata.metadata.head()

Hi!

Yes, I attempted to, but got a message saying the dataframe was too large to open. I suspect because of the repeating variables. However, I figured out what the problem was. Thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.