从列表创建数据框时看不到列表的所有值

Not seeing all values of list when I create a dataframe from list

我正在使用 VerticaPy - https://www.vertica.com/python/

我使用 train.csvtest.csv kaggle 的泰坦尼克号问题创建了两个 vDataFramevDataFrames 已正确创建

train_vdf = read_csv("train.csv")
train_vdf

test_vdf = read_csv("test.csv")
test_vdf

然后我创建一个组合列表并从中创建一个 pandas dataframe

combine = [train_vdf, test_vdf] #gives a list
combine_pdf = pd.DataFrame(combine)
combine_pdf

但输出不显示来自两个 vDataFramess

的组合数据

为什么我在 table 中看不到组合数据?

改为concat

combine_pdf = pd.concat(combine)

如果您尝试创建一个数据框,其中包含两个输入数据框中的列和行数等于每个输入的行数之和的组合,您可以这样做:

import pandas as pd
train_vdf = pd.DataFrame({
    'PassengerId' : [1,2],
    'Survived' : [0,1],
    'Pclass' : [3,1],
    'Name' : ['Braund, Mr. Owen Harris', 'Cumings, Mrs. John Bradley'],
    'Sex' : ['male', 'female'],
    'Age' : [22.0, 38.0]
})
test_vdf = pd.DataFrame({
    'PassengerId' : [895,896],
    'Pclass' : [3,3],
    'Name' : ['Wirz, Mr. Albert', 'Hirvonen, Mrs. Alexander'],
    'Sex' : ['male', 'female'],
    'Age' : [27.0, 22.0],
    'SibSp' : [0, 1]
})
df = pd.concat([train_vdf, test_vdf], ignore_index=True)
print(df)

输出:

   PassengerId  Survived  Pclass                        Name     Sex   Age  SibSp
0            1       0.0       3     Braund, Mr. Owen Harris    male  22.0    NaN
1            2       1.0       1  Cumings, Mrs. John Bradley  female  38.0    NaN
2          895       NaN       3            Wirz, Mr. Albert    male  27.0    0.0
3          896       NaN       3    Hirvonen, Mrs. Alexander  female  22.0    1.0