I am saving a dataframe to sql using the following:
df.astype({...}).to_sql('search_raw', con=self.avails_conn, index='id')
I have a few list fields, and where the entry is None, instead of saving it as NULL, it saves it as the string nan. For example:

How can I save a list-field so that a null value (not [] but None) is saved as NULL in sql rather than "nan" ?
It seems that this approach doesn't work for a list field: https://stackoverflow.com/a/54403705/651174.
This might be a bit crude, but here's how I'm doing it now:
df['all_audio_languages'] = np.where(df['all_audio_languages'] == 'nan', None, df['all_audio_languages'])
Is there a better way to do this? The above approach seems pretty hackish.
 
    