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,....
... ... ...
First I think working with list
s or array
's this way in pandas is not good idea .
But it is possible:
df['column2'] = [a for _ in df.index]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.