Code Me, dsewnr

Pandas NaN to None

October 22, 2019


Python Pandas 讀取 csv 檔把 NaN 轉成 None

import pandas as pd
import numpy as np

df = pd.read_csv("xxx.csv", encoding='utf8', header=None, low_memory=False)
df = df.replace({ None})


Written by dsewnr who lives and works in Taiwan has interest in new things. Please feel free to contact me: EmailGitHubLinkedInTwitter. You can also subscribe by email.

Partners: Liyang's Blog