我已经导入并编译了一堆原始数据中没有头的csv。数据是从网页上抓取的,每个csv都将所有数据放在一个“单元格”中,所以当我打印列名时,它会弹出100行的数据。我正在努力寻找一种方法来给予 Dataframe 中的列命名。我查看了重命名函数,但看起来我必须传递给它当前的名称,这太长了,而且是一个不断变化的数据集。我查看了重命名函数,但看起来我必须传递给它当前的名称,这太长了,而且是一个不断变化的数据集。有没有一种方法可以为第一列(也是唯一的一列)分配一个名称,而不引用它的当前名称?
statsdf = pd.concat(dfs, ignore_index=True)
print("Col Names", statsdf.columns)
Output:
Col Names Index(['Lightweight Division_x000D_\nNot Fighting_x000D_\nAalon Cruz_x000D_\nLightweight Division_x000D_\n8-4-0 (W-L-D)_x000D_\n2_x000D_\nWins by Knockout_x000D_\n2_x000D_\nWins by Submission_x000D_\n4_x000D_\nWins by Decision_x000D_\nLast fight_x000D_\nUFC 259_x000D_\n259_x000D_\n<path fill="#FAFBFD" d="M34.14,9.81c-0.42,1.56-0.79,2.9-1.22,4.47_x000D_\nc-0.07,0.27-0.26,0.68-0.21,0.93c0.13,0.6,2.08,0.37,2.79,0.37c1.1,0,2.1,0,3.14,0c-0.25,1-0.53,1.98-0.81,2.96_x000D_\nc-2.49,0-4.98,0-7.47,0c-1.09-0.1-2.52-0.58-2.37-2c0.05-0.45,0.26-0.95,0.39-1.44c0.67-2.43,1.36-4.91,2.01-7.29_x000D_\nc0.29-1.06,0.51-1.96,1.34-2.38c0.53-0.27,1.39-0.35,2.03-0.4c2.47,0,4.95,0,7.42,0C40.91,6.02,40.63,7,40.36,7.99_x000D_\nc-1.45,0-2.79,0-4.26,0c-0.51,0-1.08-0.05-1.36,0.14C34.43,8.34,34.25,9.38,34.14,9.81z M15.62,18.6l2.36-8.56h9.83l-0.82,2.98_x000D_\nh-5.26l-1.54,5.59H15.62z M29.19,5.02L28.37,8h-9.83l0.82-2.98H29.19z M12.6,5.02h4.52c0,0-3,10.85-3.15,11.43_x000D_\nc-0.29,1.13-0.57,2.15-3.3,2.15c-3.29,0-5.2-0.01-6.1,0c-1.12,0.01-2.46-1.04-2.09-2.4L5.56,5.02h4.61c0,0-2.59,9.33-2.64,9.57_x000D_\nc-0.05,0.24-0.31,0.91,1.13,0.92c1.04,0.03,1.12-0.26,1.3-0.92C10.39,13.08,12.6,5.02,12.6,5.02z" WinAutomationVisibilityLandmark="true">_x000D_\nWin_x000D_\nMedic vs Cruz_x000D_\nMar. 7, 2021_x000D_\nWatch Replay_x000D_\nRecap_x000D_\nView Fight History_x000D_\nUFC Spotlight_x000D_\nAalon Cruz Is Living His Dream_x000D_\nStats & Records_x000D_\n2_x000D_\nWins by Knockout_x000D_\n2_x000D_\nWins by Submission_x000D_\n4_x000D_\nWins by Decision_x000D_\n39%_x000D_\nStriking accuracy_x000D_\nSig. Strikes Landed_x000D_\n134_x000D_\nSig. Strikes Attempted_x000D_\n343_x000D_\n0%_x000D_\nTakedown Accuracy_x000D_\nTakedowns Landed_x000D_\nTakedowns Attempted_x000D_\n7_x000D_\n7.58_x000D_\nSig. Str. Landed_x000D_\nPer Min_x000D_\n8.88_x000D_\nSig. Str. Absorbed_x000D_\nPer Min_x000D_\n0.00_x000D_\nTakedown avg_x000D_\nPer 15 Min_x000D_\n0.00_x000D_\nSubmission avg_x000D_\nPer 15 Min_x000D_\n59_x000D_\n%_x000D_\nSig. Str. Defense_x000D_\nTakedown Defense_x000D_\n0.85_x000D_\nKnockdown Avg_x000D_\n05:54_x000D_\nAverage fight time_x000D_\nSig. Str. By Position_x000D_\nStanding_x000D_\n132 (99%)_x000D_\nClinch_x000D_\n1 (1%)_x000D_\nGround_x000D_\n1 (1%)_x000D_\nSig. Str. by target_x000D_\n62%_x000D_\n83_x000D_\nHead_x000D_\n27%_x000D_\n36_x000D_\nBody_x000D_\n11%_x000D_\n15_x000D_\nLeg_x000D_\n<path fill="#FAFAFA" stroke="#FAFAFA" stroke-width="6" stroke-miterlimit="10" d="M126.91,13.33_x000D_\nc3.46,0.87,6.43,3.7,6.92,7.32c0.19,1.43,0.17,2.84,0.8,4.29c0.6,1.39,0.08,3.35-1.19,4.47c-2.01,1.78-1.83,4.14-2.2,6.36_x000D_\nc-0.12,0.71,0.34,1.52,1.01,2.04c3.13,2.43,6.31,4.91,10.19,5.94c3.41,0.9,5.51,2.66,6.33,5.96c0.25,0.99,0.45,1.98,0.56,3_x000D_\nc0.3,2.86,0.38,5.74,0.89,8.59c1.12,6.21,3,12.23,4.53,18.33c1.92,7.64,1.97,15.46,1.9,23.28c-0.03,2.69,0.23,5.33,1.16,7.89v1.44_x000D_\nc-0.69,2.39-1.75,4.49-4.47,5.25c-1.14,0.32-2.23,0.25-3.08-0.63c-0.8-0.83-0.88-1.81-0.37-2.83c0.16-0.32,0.27-0.67,0.31-1.03_x000D_\nc0.44-3.48,0.36-7.01,1.13-10.46c0.33-1.48-0.13-2.99-0.82-4.36c-3.42-6.77-4.99-14.01-5.81-21.45c-0.26-2.37-1.23-4.5-2.37-6.96_x000D_\nc-0.55,1.8-0.8,3.22-1.21,4.6c-1.24,4.2-1.49,8.43-1.09,12.81c0.3,3.35,1.06,6.63,1.22,9.98c-0.02,0.29-0.09,0.56-0.19,0.8_x000D_\nc0.41,1.47,0.65,2.98,0.87,4.48c0.21,0.99,0.43,1.99,0.64,2.98c0.25,1.55,0.5,3.11,0.75,4.66c0.02,0.24,0.04,0.47,0.06,0.71_x000D_\nc0.45,0.7,0.26,1.47,0.29,2.22c0.12,0.11,0.24,0.25,0.33,0.42c0.98,5.36,0.44,10.74,0.11,16.1c-0.24,3.95-0.9,7.86,0.83,11.66_x000D_\nc0.34,0.76,0.47,1.63,0.42,2.47c-0.16,2.3,0.62,4.33,1.67,6.35c1.28,2.47,2.26,5.05,2.4,7.87c-0.03,0.43-0.12,0.85-0.23,1.27_x000D_\nc0.27,1.81,0.22,3.62,0.01,5.43c0.06,0.52,0.1,1.05,0.14,1.57c0.3,2.67-0.41,5.24-0.85,7.83c-0.56,3.34-0.61,6.61-0.09,9.99_x000D_\nc0.34,2.19,0.78,3.89,2.71,5.27c1.31,0.94,0.86,2.28-0.71,2.88c-0.92,0.35-1.92,0.37-2.88,0.57c-1.26,0.25-2.58-0.34-3.78,0.33_x000D_\nh-1.11c-1.86-0.75-2.25-1.31-2.09-3.27c0.09-1.21,0.05-2.39-0.16-3.58c-0.19-1.07-0.31-2.2,0.12-3.2c0.92-2.17,0.6-4.36,0.29-6.55_x000D_\nc-0.28-1.96-0.75-3.89-1.2-5.82c-1.02-4.38-2.57-8.68-2.59-13.21c-0.01-3.52-1-6.76-2.41-9.9c-1.72-3.82-2.82-7.79-3.6-11.87_x000D_\nc-1-5.25-2.01-10.49-3.24-15.69c-0.58-2.44-1.46-4.84-1.48-7.39c0.01-0.13-0.45-0.51-0.99-0.91c-0.51,0.38-0.93,0.73-0.92,0.86_x000D_\nc-0.01,2.55-0.9,4.95-1.48,7.39c-1.23,5.2-2.24,10.45-3.24,15.69c-0.78,4.08-1.88,8.05-3.6,11.87c-1.41,3.14-2.4,6.37-2.41,9.9_x000D_\nc-0.02,4.53-1.57,8.84-2.59,13.21c-0.45,1.93-0.92,3.85-1.2,5.82c-0.31,2.2-0.63,4.38,0.29,6.55c0.43,1.01,0.31,2.14,0.12,3.2_x000D_\nc-0.21,1.19-0.25,2.38-0.16,3.58c0.15,1.95-0.24,2.51-2.09,3.27h-1.11c-1.2-0.67-2.52-0.08-3.78-0.33_x000D_\nc-0.96-0.19-1.96-0.21-2.88-0.57c-1.58-0.6-2.03-1.94-0.71-2.88c1.93-1.38,2.37-3.08,2.71-5.27c0.52-3.38,0.48-6.66-0.09-9.99_x000D_\nc-0.44-2.59-1.15-5.16-0.85-7.83c0.04-0.53,0.07-1.05,0.14-1.57c-0.21-1.81-0.26-3.62,0.01-5.43c-0.11-0.42-0.2-0.85-0.23-1.27_x000D_\nc0.14-2.81,1.13-5.4,2.4-7.86c1.04-2.02,1.83-4.05,1.67-6.35c-0.06-0.84,0.07-1.71,0.42-2.47c1.72-3.8,1.07-7.72,0.83-11.66_x000D_\nc-0.33-5.36-0.87-10.74,0.11-16.1c0.09-0.17,0.21-0.3,0.33-0.42c0.03-0.75-0.16-1.52,0.29-2.22c0.02-0.24,0.04-0.47,0.06-0.71_x000D_\nc0.25-1.55,0.5-3.11,0.75-4.66c0.21-0.99,0.43-1.99,0.64-2.98c0.23-1.51,0.47-3.01,0.87-4.48c-0.1-0.24-0.17-0.5-0.19-0.8_x000D_\nc0.16-3.35,0.92-6.63,1.22-9.98c0.4-4.38,0.15-8.61-1.09-12.81c-0.41-1.38-0.66-2.8-1.21-4.6c-1.14,2.46-2.1,4.59-2.37,6.96_x000D_\nc-0.82,7.43-2.39,14.68-5.81,21.45c-0.69,1.37-1.15,2.88-0.82,4.36c0.77,3.46,0.7,6.98,1.13,10.46c0.05,0.36,0.15,0.71,0.31,1.03_x000D_\nc0.51,1.03,0.43,2.01-0.37,2.83c-0.85,0.88-1.94,0.95-3.08,0.63c-2.72-0.75-3.78-2.85-4.47-5.25v-1.44_x000D_\nc0.92-2.55,1.18-5.19,1.16-7.89c-0.07-7.81-0.02-15.64,1.9-23.28c1.54-6.1,3.41-12.13,4.53-18.33c0.51-2.85,0.6-5.73,0.89-8.59_x000D_\nc0.11-1.02,0.31-2.01,0.56-3c0.82-3.3,2.91-5.06,6.33-5.96c3.88-1.03,7.07-3.51,10.19-5.94c0.67-0.52,1.13-1.33,1.01-2.04_x000D_\nc-0.36-2.21-0.18-4.58-2.2-6.36c-1.27-1.13-1.79-3.08-1.19-4.47c0.63-1.46,0.61-2.87,0.8-4.29c0.49-3.61,3.46-6.44,6.92-7.32_x000D_\nc0-0.11,0-0.17,0-0.17c0.4-0.05,0.8-0.06,1.2-0.05c0.66-0.08,1.32-0.08,1.99,0C126.91,13.06,126.91,13.15,126.91,13.33z" WinAutomationVisibilityLandmark="true">_x000D_\n<path id="e-stat-body_x5F__x5F_head" opacity="1" fill="#D20A0A" d="M134.63,24.95_x000D_\nc-0.63-1.46-0.61-2.87-0.8-4.29c-0.49-3.61-3.46-6.44-6.92-7.32c0-0.18,0-0.28,0-0.28c-0.66-0.08-1.33-0.07-1.99,0_x000D_\nc-0.4-0.01-0.8,0.01-1.2,0.05c0,0,0,0.06,0,0.17c-3.46,0.87-6.43,3.7-6.92,7.32c-0.19,1.43-0.17,2.84-0.8,4.29_x000D_\nc-0.6,1.39-0.08,3.35,1.19,4.47c2.01,1.78,1.83,4.14,2.2,6.36c0.12,0.71-0.34,1.52-1.01,2.04c-2.09,1.63-4.22,3.27-6.56,4.49h26.89_x000D_\nc-2.3-1.22-4.39-2.83-6.45-4.43c-0.67-0.52-1.13-1.33-1.01-2.04c0.36-2.21,0.18-4.58,2.2-6.36_x000D_\nC134.71,28.29,135.23,26.34,134.63,24.95z" WinAutomationVisibilityLandmark="true">_x000D_\n<path id="e-stat-body_x5F__x5F_body" opacity="0.49036144578313" fill="#D20A0A" d="M108.18,43.7_x000D_\nc-3.41,0.9-5.51,2.66-6.33,5.96c-0.25,0.99-0.45,1.98-0.56,3c-0.3,2.86-0.38,5.74-0.89,8.59c-1.12,6.21-3,12.23-4.53,18.33_x000D_\nc-1.92,7.64-1.97,15.46-1.9,23.28c0.03,2.69-0.23,5.33-1.16,7.89v1.44c0.69,2.39,1.75,4.49,4.47,5.25c1.14,0.32,2.23,0.25,3.08-0.63_x000D_\nc0.8-0.83,0.88-1.81,0.37-2.83c-0.16-0.32-0.27-0.67-0.31-1.03c-0.44-3.48-0.36-7.01-1.13-10.46c-0.33-1.48,0.13-2.99,0.82-4.36_x000D_\nc3.42-6.77,4.99-14.01,5.81-21.45c0.26-2.37,1.23-4.5,2.37-6.96c0.55,1.8,0.8,3.22,1.21,4.6c1.24,4.2,1.49,8.43,1.09,12.81_x000D_\nc-0.3,3.35-1.06,6.63-1.22,9.98c0.02,0.29,0.09,0.56,0.19,0.8c-0.41,1.47-0.65,2.98-0.87,4.48c-0.21,0.99-0.43,1.99-0.64,2.98_x000D_\nc-0.25,1.55-0.5,3.11-0.75,4.66c-0.02,0.24-0.04,0.47-0.06,0.71c-0.45,0.7-0.26,1.47-0.29,2.22c-0.12,0.11-0.24,0.25-0.33,0.42_x000D_\nc-0.39,2.13-0.53,4.25-0.55,6.38h16.84c0.58-2.4,1.44-4.77,1.45-7.29c-0.01-0.12,0.41-0.48,0.92-0.86c0.54,0.4,1.01,0.78,0.99,0.91_x000D_\nc0.01,2.5,0.86,4.85,1.44,7.24h16.86c-0.02-2.11-0.17-4.22-0.55-6.33c-0.09-0.17-0.21-0.3-0.33-0.42c-0.03-0.75,0.16-1.52-0.29-2.22_x000D_\nc-0.02-0.24-0.04-0.47-0.06-0.71c-0.25-1.55-0.5-3.11-0.75-4.66c-0.21-0.99-0.43-1.99-0.64-2.98c-0.23-1.51-0.47-3.01-0.87-4.48_x000D_\nc0.1-0.24,0.17-0.5,0.19-0.8c-0.16-3.35-0.92-6.63-1.22-9.98c-0.4-4.38-0.15-8.61,1.09-12.81c0.41-1.38,0.66-2.8,1.21-4.6_x000D_\nc1.14,2.46,2.1,4.59,2.37,6.96c0.82,7.43,2.39,14.68,5.81,21.45c0.69,1.37,1.15,2.88,0.82,4.36c-0.77,3.46-0.7,6.98-1.13,10.46_x000D_\nc-0.05,0.36-0.15,0.71-0.31,1.03c-0.51,1.03-0.43,2.01,0.37,2.83c0.85,0.88,1.94,0.95,3.08,0.63c2.72-0.75,3.78-2.85,4.47-5.25_x000D_\nv-1.44c-0.92-2.55-1.18-5.19-1.16-7.89c0.07-7.81,0.02-15.64-1.9-23.28c-1.54-6.1-3.41-12.13-4.53-18.33_x000D_\nc-0.51-2.85-0.6-5.73-0.89-8.59c-0.11-1.02-0.31-2.01-0.56-3c-0.82-3.3-2.91-5.06-6.33-5.96c-1.32-0.35-2.56-0.88-3.74-1.5h-26.89_x000D_\nC110.66,42.85,109.46,43.36,108.18,43.7z" WinAutomationVisibilityLandmark="true">_x000D_\n<path opacity="0.26265060240964" fill="#D20A0A" d="M144.56,119.75H127.7c0.01,0.05,0.03,0.1,0.04,0.15_x000D_\nc1.23,5.2,2.24,10.45,3.24,15.69c0.78,4.08,1.88,8.05,3.6,11.87c1.41,3.14,2.4,6.37,2.41,9.9c0.02,4.53,1.57,8.84,2.59,13.21_x000D_\nc0.45,1.93,0.92,3.85,1.2,5.82c0.31,2.2,0.63,4.38-0.29,6.55c-0.43,1.01-0.31,2.14-0.12,3.2c0.21,1.19,0.25,2.38,0.16,3.58_x000D_\nc-0.15,1.95,0.24,2.51,2.09,3.27h1.11c1.2-0.67,2.52-0.08,3.78-0.33c0.96-0.19,1.96-0.21,2.88-0.57c1.58-0.6,2.03-1.94,0.71-2.88_x000D_\nc-1.93-1.38-2.37-3.08-2.71-5.27c-0.52-3.38-0.48-6.66,0.09-9.99c0.44-2.59,1.15-5.16,0.85-7.83c-0.04-0.53-0.07-1.05-0.14-1.57_x000D_\nc0.21-1.81,0.26-3.62-0.01-5.43c0.11-0.42,0.2-0.85,0.23-1.27c-0.14-2.81-1.13-5.4-2.4-7.86c-1.04-2.02-1.83-4.05-1.67-6.35_x000D_\nc0.06-0.84-0.07-1.71-0.42-2.47c-1.72-3.8-1.07-7.72-0.83-11.66C144.32,126.27,144.59,123.01,144.56,119.75z" WinAutomationVisibilityLandmark="true">_x000D_\n<path opacity="0.26265060240964" fill="#D20A0A" d="M100.23,192.05c0.92,0.35,1.92,0.37,2.88,0.57_x000D_\nc1.26,0.25,2.58-0.34,3.78,0.33H108c1.86-0.75,2.25-1.31,2.09-3.27c-0.09-1.21-0.05-2.39,0.16-3.58c0.19-1.07,0.31-2.2-0.12-3.2_x000D_\nc-0.92-2.17-0.6-4.36-0.29-6.55c0.28-1.96,0.75-3.89,1.2-5.82c1.02-4.38,2.57-8.68,2.59-13.21c0.01-3.52,1-6.76,2.41-9.9_x000D_\nc1.72-3.82,2.82-7.79,3.6-11.87c1-5.25,2.01-10.49,3.24-15.69c0.01-0.03,0.02-0.07,0.02-0.1h-16.84c-0.03,3.24,0.24,6.48,0.44,9.71_x000D_\nc0.24,3.95,0.9,7.86-0.83,11.66c-0.34,0.76-0.47,1.63-0.42,2.47c0.16,2.3-0.62,4.33-1.67,6.35c-1.28,2.47-2.26,5.05-2.4,7.87_x000D_\nc0.03,0.43,0.12,0.85,0.23,1.27c-0.27,1.81-0.22,3.62-0.01,5.43c-0.06,0.52-0.1,1.05-0.14,1.57c-0.3,2.67,0.41,5.24,0.85,7.83_x000D_\nc0.56,3.34,0.61,6.61,0.09,9.99c-0.34,2.19-0.78,3.89-2.71,5.27C98.2,190.12,98.65,191.45,100.23,192.05z" WinAutomationVisibilityLandmark="true">_x000D_\nWin by Method_x000D_\nKO/TKO_x000D_\n2 (25%)_x000D_\nDEC_x000D_\n4 (50%)_x000D_\nSUB_x000D_\n2 (25%)_x000D_\nathlete record_x000D_\nEvent Results_x000D_\nWin_x000D_\nMedic_x000D_\nvs_x000D_\nCruz_x000D_\nMar. 7, 2021_x000D_\nRound_x000D_\n1_x000D_\nTime_x000D_\n1:40_x000D_\nMethod_x000D_\nKO/TKO_x000D_\nHow to watch_x000D_\nFollow live_x000D_\nCruz_x000D_\nvs_x000D_\nCarlyle_x000D_\nMar. 1, 2020_x000D_\nRound_x000D_\n1_x000D_\nTime_x000D_\n1:25_x000D_\nMethod_x000D_\nTKO_x000D_\nHow to watch_x000D_\nFollow live_x000D_\nInfo_x000D_\nLearn more about Aalon Cruz’s UFC history, fighter facts, and Q&A below._x000D_\nBio_x000D_\nQ&A_x000D_\nBio_x000D_\nStatus_x000D_\nNot Fighting_x000D_\nHometown_x000D_\nParrish, United States_x000D_\nFighting style_x000D_\nMMA_x000D_\nAge_x000D_\n33_x000D_\nHeight_x000D_\n72.00_x000D_\nWeight_x000D_\n155.00_x000D_\nOctagon Debut_x000D_\nJul. 30, 2019_x000D_\nReach_x000D_\n78.00_x000D_\nLeg reach_x000D_\n42.00_x000D_\nShop the latest apparel from the official UFC store._x000D_\nBehind-the-scenes access & Fan only fights every month.'], dtype='object')
1条答案
按热度按时间lrpiutwd1#
我猜这个代码:
注意:
statsdf.columns[0]
引用第一个标题名称