I am trying to write code to load an excel file that will return:
- the entire data frame
- total number of rows
- total number of columns
I wrote the following code but it gave an error: TypeError: cannot unpack non-iterable int object Can you please help me with this, thank you!
def load_data():
import pandas as pd
df = pd.read_csv("myfile.csv")
num_rows = df.shape[0]
num_cols = df.shape[1]
return num_rows
return num_cols
df, num_rows, num_cols = load_data()