第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

為什么沒(méi)有定義 csv?

為什么沒(méi)有定義 csv?

呼喚遠(yuǎn)方 2022-09-20 17:27:01
plt.style.use('ggplot')g = sns.catplot(    x = 'YearBuilt',    y = 'SalePrice',    data = train,    kind='swarm',    hue='OverallQual',    palette = 'Set2', height=6, aspect=2)locs, labels = plt.xticks()  # use if needed, as explained below.for axes in g.axes.flat:    for ind, label in enumerate(axes.get_xticklabels()):        if ind % 8 == 0:  # every nth label is kept            label.set_visible(True)        else:            label.set_visible(False)plt.title('House Sale Prices (log scale) vs. Year Built and Overall Quality')plt.xlabel('Year Built')plt.yscale('log')plt.ylim([4e4, 6e5])plt.yticks([6e4, 1e5, 1.4e5, 1.8e5, 2.4e5, 3.2e5, 4e5, 6e5], ['60k', '100k', '140K', '180k', '240K', '320k', '600k'])plt.ylabel('Sale Price ($)')plt.show()我正在嘗試對(duì)csv文件進(jìn)行相對(duì)簡(jiǎn)單的解析,我不明白為什么csv模塊不起作用。這是我的代碼:import csvdef getFromCSV(fileName):    with open(fileName, 'r') as f:        reader = csv.reader(f)        data = list(reader)    return datadef append_row(fileName, my_list):    with open(fileName, 'a') as output:        writer = csv.writer(output)        writer.writerow(my_list)data = getFromCSV('dh_internal_all.csv')for row in data:    if '25252' not in row:        print(row)        append_row('parsed.csv',[row])這將返回:dh-dfbhv2l:Documents jwr38$ python3 remove_bad_data.py Traceback (most recent call last):  File "remove_bad_data.py", line 13, in <module>    data = getFromCSV('dh_internal_all.csv')  File "remove_bad_data.py", line 3, in getFromCSV    reader = csv.reader(f)NameError: name 'csv' is not defined提前感謝您的任何提示。編輯:當(dāng)我在終端中運(yùn)行時(shí),然后,然后,它似乎識(shí)別它,它返回:python3import csvcsv<module 'csv' from '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/csv.py'>
查看完整描述

1 回答

?
BIG陽(yáng)

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊

您粘貼了錯(cuò)誤的代碼。在回溯中,斷層線為 3,但在此代碼中為 5 - 缺少的兩行可能是“導(dǎo)入 csv”行。


查看完整回答
反對(duì) 回復(fù) 2022-09-20
  • 1 回答
  • 0 關(guān)注
  • 136 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)