Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19.9k points)

I have a pandas Dataframe like as follow:

                   column1         column2

0                     0               0

1                     0               0

2                     0               0

3                     0               0

...                  ...             ...

I would like to change all data in column2 with

a = numpy.zeros([16,16,16])

so the dataframe will look like

                   column1         column2

0                     0           [[[0,0,0,....

1                     0           [[[0,0,0,....

2                     0           [[[0,0,0,....

3                     0           [[[0,0,0,....

...                  ...             ...

1 Answer

0 votes
by (25.1k points)

To change the data in a data frame and set to your desired value you can do this:

df['column2'] = [x for idx in df.index]

Browse Categories

...