Python schemaValidation error when reading from pandas dataframe

问题描述 投票:0回答:0

我正在使用 altair 和 python 来可视化地图。

with open('cities.csv', encoding='utf-8') as f:

    city = alt.Chart(f).mark_circle().encode(
    latitude='latitude:Q',
    longitude='longitude:Q',
    opacity=alt.value(0.5),
    color=alt.value('steelblue')
    )

city

我收到这个错误:

SchemaValidationError:无效规范

    altair.vegalite.v4.api.Chart->0, validating 'anyOf'

    <_io.TextIOWrapper name='cities.csv' mode='r' encoding='utf-8'> is not valid under any of the given schemas

所以我想我需要使用不同的编码?当我在遇到 unicode 编码错误之前尝试此操作时,这就是为什么我首先使用 with open 行的原因。

谢谢。

python altair python-unicode
© www.soinside.com 2019 - 2024. All rights reserved.