You may then need to access part of that DataFrame using something like dataframe.iloc[0] where the aforementioned command gives the row at position 0.
However, what if that row is empty? There is a predicate dataframe.empty you can use as follows:
if df.empty:
print "DataFrame is empty"
DataFrames are like spreadsheets or SQL tables. They are the most commonly used data structures in pandas, and like a spreadsheet, columns don't need to be of the same type.
No comments:
Post a Comment