为什么运行df.head后会发生断开

2024-09-30 03:25:13 发布

您现在位置:Python中文网/ 问答频道 /正文

df1.info()

df = pd.DataFrame([[x for x in df1['final_resp']]])

df['resp']

[['Office/work], ['car/scooter'], ['Sometimes'], ['Saw scooters'], ['Cost-effective'],  ['31-40'], ['Salaried], ['PhD degree']]
[['Park/College], ['scooter'], ['Sometimes'], ['Saw scooters'], ['Cost-effective'],  ['31-40'], ['Salaried], ['Bachelors']]

resp值必须拆分并放入下一列

每次运行df.head(1)后我的连接断开时

我的输出是所有列在列数周围重复,这意味着[['Office/work], ['car/scooter'], ['Sometimes'], ['Saw scooters'], ['Cost-effective'], ['31-40'], ['Salaried], ['PhD degree']]重复2000次,因为这是我的矩阵形状


Tags: dfcarrespworkdf1officephdcost

热门问题