Q. From the dataframes created in previous question, write code to
(a) Display only column 'a' from dataframes df, df1, and df2.
(b) Display only rows 0 and 1 from dataframes df, df1, and df2.
(c) Display only column 'a' and 'b' for rows 1 and 2 from dataframes df, df1 and df2.
(d) add an empty column 'x' to all dataframes.
Answer =
(a) df["a"] , df1[“a”] , df2[“a”]
(b) df.iloc[0:2] df1.iloc[0:2] , df2.iloc[0:2]
(c) df[["a","b"]] , df1[["one","two"]] , df2[["one","two"]]
(d) df["X"]=[None]*len(df)
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )