Есть ли способ создания Dataframe с использованием sheet_to_df, но в результате DF содержит NaN для пустых значений Null? - PullRequest
0 голосов
/ 10 апреля 2019

Я импортирую Google-лист, используя Drive API, затем преобразую прочитанный лист в DataFrame, но полученный DataFrame не содержит значений NaN для пустых значений из исходного листа.Я пытался найти и прочитать документацию, но я не получаю средства, чтобы предотвратить это.

Вот пример кода

    # Fetching the sheet from Google sheet
    s = gspread_pandas.client.Spread('nickson_kayonza','Operational 
    data tracker - RW-2 Kayonza')
    # Opening only the sheet I want in this case I am opening the 
   'Order to launch' 
    s.open_sheet('Order to launch')

    ops_data = s.sheet_to_df(start_row =2)
    ops_data.info()

Мне удалось решить проблему, простофильтрация пустых значений, т.е.

    nuls = ops_data[ops_data['Facility'] =='']

Я надеялся использовать значение NaN для некоторой очистки данных, поэтому я хотел бы сохранить их.

здесь вывод

    ops_data.info()


    <class 'pandas.core.frame.DataFrame'>
    Index: 1727 entries, 01/31/2019 to 
    Data columns (total 31 columns):
    Facility                             1727 non-null object
    Order confirmed time                 1727 non-null object
    Order confirmed time                 1727 non-null object
    Order type                           1727 non-null object
    Pick/pack start time                 1727 non-null object
    Pick/pack start time                 1727 non-null object
    Package ID                           1727 non-null object
    Package committed time               1727 non-null object
    Package committed time               1727 non-null object
                                         1727 non-null object
    Flight launched time                 1727 non-null object
    Flight launched time                 1727 non-null object
    Call: Takeoff clearance              1727 non-null object
    Recovery (or flight failure) time    1727 non-null object
    Recovery (or flight failure) time    1727 non-null object
    Call: After reco.                    1727 non-null object
    Pip Body #                           1727 non-null object
    Flight ID                            1727 non-null object
    Delivery status                      1727 non-null object
    Mission failure (if applicable)      1727 non-null object
                                         1727 non-null object
    Fulfillment off-nominal event - 1    1727 non-null object
    Fulfillment off-nominal event - 2    1727 non-null object
                                 1727 non-null object
    Flight off-nominal event - 1         1727 non-null object
    Flight off-nominal event - 2         1727 non-null object
    Flight off-nominal event - 3         1727 non-null object
    Flight off-nominal event - 4         1727 non-null object
    Downtime events - 1                  1727 non-null object
    Downtime events - 2                  1727 non-null object
    Comments                             1727 non-null object
    dtypes: object(31)
    memory usage: 431.8+ KB
...