我有 2 个数字系列:A = (24,25,26,27,28,29) 和 B = (105,106,107,108,109)。一个包含两列 A 和 B 的 DataFrame,例如:
import numpy as np
import pandas as pd
A = pd.Series(np.array([24, 25, 26, 27, 28, 29]))
B = pd.Series(np.array([105, 106, 107, 108, 109]))
AB_dataframe = pd.DataFrame({
'A': [25, 25, 25, 26, 26, 27, 27, 28, 29],
'B': [106, 108, 109, 108, 109, 106, 108, 108, 107]
})
Run Code Online (Sandbox Code Playgroud)
AB_dataframe:
A B
0 25 106
1 25 108
2 25 109
3 26 108
4 26 109 …Run Code Online (Sandbox Code Playgroud)