How to Capture Data with Pandas?

Asked

Viewed 48 times

1

I work with a database that uses frequency, and I want to analyze the frequency data and transform it into several lines. Follow image example:

inserir a descrição da imagem aqui

I want to make line 6, for example, become 6 equal lines with the same data. I thought to "rewrite" the whole spreadsheet and save as a new one because it may be that only modify the lines give some problem.

1 answer

1


I believe that what you seek can be achieved with reindex and repeat:

df.reindex(df.index.repeat(df.FREQUENCIA))

Unfortunately I have no way to demonstrate the output of the data because you uploaded an image as sample and I have no way to "copy" the data in this way

  • 1

    Thank you very much, it was just that. I’m extremely happy that it worked hahaha a lifetime long!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.