我正在使用驱动器API导入google工作表,然后将读取的工作表转换为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