'Using keep_default_na=False with pd.DataFrame

I'm reading a Google sheet document and need to prevent pandas from interpreting NA as NaN but still want to retain NaN for empty values.

This is the code I am using below to open the spreadhseet:

import gspread 
gc = gspread.authorize(credentials)

spreadsheet = gc.open_by_key(SPREADSHEET_ID_INPUT)
tab_name = 'tab_1'
input_tab = spreadsheet.worksheet(tab_name)

df =  pd.DataFrame(input_tab.get_all_records())

But I would like to add the following but not sure how to add it:

keep_default_na = False, na_values = '_'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source