在尝试执行挤压时能够导入 CSV,但它看起来像数据框而不是系列?
这是我试过的
import pandas as pd
import numpy as np
dnd_name = pd.read_csv(r"dnd-dataframe.csv", usecols = ["name"], squeeze = True)
dnd_name.head()
这是我的预期至少我记得学习输出不是数据框而是更像是一个系列?
我原以为它会像一个系列而不是数据框,看起来像这样
name
bam Bard Dagger, sling, club Transmutation, Enchantment
niem Sorcerer light crossbow, battleaxe Necromancy
aem Paladin Greataxe Abjuration, Conjuration
yaeks Rogue club, battleaxe Conjuration, Evocation, Transmutation
jeeks Druid Dagger, Greataxe Evocation, Transmutation, Necromancy
Name: Type, dtype: object
这是错误
但是相反,我收到了一个错误
import pandas as pd
import numpy as np
dnd_name = pd.read_csv(r"dnd-dataframe.csv", usecols = ["name"], squeeze = True)
dnd_name.head()
收到错误
usecols_dtype = lib.infer_dtype(usecols, skipna=False)
ValueError: 'usecols' must either be list-like of all strings, all unicode, all integers or a callable.
我也试过这个措辞但看起来也不像预期的那样
import pandas as pd
import numpy as np
dnd_name = pd.read_csv(r"dnd-dataframe.csv", index_col = "name", squeeze = True)
dnd_name.head()
摇曳的蔷薇
相关分类