Python 如何修复列标题?
我想使用熊猫的csv数据。但有一个问题。 就是数据头向右移动了三列。 因此,无法使用正确的数据 我想这可能是因为最后三个标题是空的。 请告诉我如何通过熊猫获取正确的csv数据。 我将csv数据定位到图像描述中Python 如何修复列标题?,python,pandas,Python,Pandas,我想使用熊猫的csv数据。但有一个问题。 就是数据头向右移动了三列。 因此,无法使用正确的数据 我想这可能是因为最后三个标题是空的。 请告诉我如何通过熊猫获取正确的csv数据。 我将csv数据定位到图像描述中 import pandas as pd csv_df = pd.read_csv(file_path,header=0) print(csv_df) 您必须为csv文件中的每一列包含一个列名 import pandas as pd csv_df = pd.read_csv(
import pandas as pd
csv_df = pd.read_csv(file_path,header=0)
print(csv_df)
您必须为csv文件中的每一列包含一个列名
import pandas as pd
csv_df = pd.read_csv(file_path)
print(csv_df)
或完全删除所有列名并执行以下操作:
import pandas as pd
csv_df = pd.read_csv(file_path, header=None)
print(csv_df)
我解不出这个密码 但我用它来解决这个问题
import pandas as pd
csv_df = pd.read_csv('/content/drive/My Drive/data/data_estimated/box1Analize.csv',header=1,
names= ['frame', 'Nose_x', 'Nose_y', 'Nose_score', 'Neck_x', 'Neck_y',
'Neck_score', 'RShoulder_x', 'RShoulder_y', 'RShoulder_score',
'RElbow_x', 'RElbow_y', 'RElbow_score', 'RWrist_x', 'RWrist_y',
'RWrist_score', 'LShoulder_x', 'LShoulder_y', 'LShoulder_score',
'LElbow_x', 'LElbow_y', 'LElbow_score', 'LWrist_x', 'LWrist_y',
'LWrist_score', 'RHip_x', 'RHip_y', 'RHip_score', 'RKnee_x', 'RKnee_y',
'RKnee_score', 'RAnkle_x', 'RAnkle_y', 'RAnkle_score', 'LHip_x',
'LHip_y', 'LHip_score', 'LKnee_x', 'LKnee_y', 'LKnee_score', 'LAnkle_x',
'LAnkle_y', 'LAnkle_score', 'REye_x', 'REye_y', 'REye_score', 'LEye_x',
'LEye_y', 'LEye_score', 'REar_x', 'REar_y', 'REar_score', 'LEar_x',
'LEar_y', 'LEar_score', 'head_cog_x', 'head_cog_y', 'head_cog_score',
'torso_cog_x', 'torso_cog_y', 'torso_cog_score', 'r_thigh_cog_x',
'r_thigh_cog_y', 'r_thigh_cog_score', 'l_thigh_cog_x', 'l_thigh_cog_y',
'l_thigh_cog_score', 'r_leg_cog_x', 'r_leg_cog_y', 'r_leg_cog_score',
'l_leg_cog_x', 'l_leg_cog_y', 'l_leg_cog_score', 'r_foot_cog_x',
'r_foot_cog_y', 'r_foot_cog_score', 'l_foot_cog_x', 'l_foot_cog_y',
'l_foot_cog_score', 'r_arm_cog_x', 'r_arm_cog_y', 'r_arm_cog_score',
'l_arm_cog_x', 'l_arm_cog_y', 'l_arm_cog_score', 'r_forearm_cog_x',
'r_forearm_cog_y', 'r_forearm_cog_score', 'l_forearm_cog_x',
'l_forearm_cog_y', 'l_forearm_cog_score', 'r_hand_cog_x',
'r_hand_cog_y', 'r_hand_cog_score', 'l_hand_cog_x', 'l_hand_cog_y',
'l_hand_cog_score','undif_1','undif_2','undif_3'])
print(csv_df)
import pandas as pd
csv_df = pd.read_csv('/content/drive/My Drive/data/data_estimated/box1Analize.csv',header=1,
names= ['frame', 'Nose_x', 'Nose_y', 'Nose_score', 'Neck_x', 'Neck_y',
'Neck_score', 'RShoulder_x', 'RShoulder_y', 'RShoulder_score',
'RElbow_x', 'RElbow_y', 'RElbow_score', 'RWrist_x', 'RWrist_y',
'RWrist_score', 'LShoulder_x', 'LShoulder_y', 'LShoulder_score',
'LElbow_x', 'LElbow_y', 'LElbow_score', 'LWrist_x', 'LWrist_y',
'LWrist_score', 'RHip_x', 'RHip_y', 'RHip_score', 'RKnee_x', 'RKnee_y',
'RKnee_score', 'RAnkle_x', 'RAnkle_y', 'RAnkle_score', 'LHip_x',
'LHip_y', 'LHip_score', 'LKnee_x', 'LKnee_y', 'LKnee_score', 'LAnkle_x',
'LAnkle_y', 'LAnkle_score', 'REye_x', 'REye_y', 'REye_score', 'LEye_x',
'LEye_y', 'LEye_score', 'REar_x', 'REar_y', 'REar_score', 'LEar_x',
'LEar_y', 'LEar_score', 'head_cog_x', 'head_cog_y', 'head_cog_score',
'torso_cog_x', 'torso_cog_y', 'torso_cog_score', 'r_thigh_cog_x',
'r_thigh_cog_y', 'r_thigh_cog_score', 'l_thigh_cog_x', 'l_thigh_cog_y',
'l_thigh_cog_score', 'r_leg_cog_x', 'r_leg_cog_y', 'r_leg_cog_score',
'l_leg_cog_x', 'l_leg_cog_y', 'l_leg_cog_score', 'r_foot_cog_x',
'r_foot_cog_y', 'r_foot_cog_score', 'l_foot_cog_x', 'l_foot_cog_y',
'l_foot_cog_score', 'r_arm_cog_x', 'r_arm_cog_y', 'r_arm_cog_score',
'l_arm_cog_x', 'l_arm_cog_y', 'l_arm_cog_score', 'r_forearm_cog_x',
'r_forearm_cog_y', 'r_forearm_cog_score', 'l_forearm_cog_x',
'l_forearm_cog_y', 'l_forearm_cog_score', 'r_hand_cog_x',
'r_hand_cog_y', 'r_hand_cog_score', 'l_hand_cog_x', 'l_hand_cog_y',
'l_hand_cog_score','undif_1','undif_2','undif_3'])
print(csv_df)