擅长:python、mysql、java
<pre><code>import pandas as pd
import numpy as np
# Creating two dataframes with data that overlap, so we don't want all of the 'b' data.
# We want to strip off '3,4,5' as they exist in 'a' as well
# Creating the data frames
a = [1,2,3,4,5]
b = [3,4,5,6,7,8,9,10]
dfa = pd.DataFrame(a)
dfa.to_csv('one.csv', index=False)
dfb = pd.DataFrame(b)
dfb.to_csv('two.csv', index = False)
# -
# Reading through the dataframes -
one = pd.read_csv('one.csv')
two = pd.read_csv('two.csv')
# -
# Stripping off the first 3 data of 'two' the list
output = one.append(two[3:])
output.to_csv("output.csv", sep=',', index=False)
# -
</code></pre>
<p>我希望这能回答你的问题。对你来说最重要的部分是<code>output = one.append(two[3:])</code>。有更复杂的方法来做同样的事情,但这是最简单的。你知道吗</p>