擅长:python、mysql、java
<p>使用<code>pandas</code>很简单:</p>
<pre><code>import pandas as pd
df = pd.read_csv("mytxt.txt", delimiter=':', header=None)
# If you just want to see the results
df.mean(axis=1,numeric_only=True)
# Create a new column to store the results
df['average'] = df.mean(axis=1,numeric_only=True)
df.head(5)
0 1 2 3 4 5 average
0 Blancke Karen 16 15 17 15 18 16.2
1 Boddin Sophie 10 10 10 11 9 10.0
2 Bogaert Tim 12 12 13 13 11 12.2
3 Bossuyt Giovanni 14 20 19 19 17 17.8
4 Boucherie Bram 13 12 12 13 12 12.4
</code></pre>
<p>本例中使用的txt:<a href="https://gofile.io/?c=I6rLX0" rel="nofollow noreferrer">https://gofile.io/?c=I6rLX0</a></p>