Python Assignment 1.ipynb - Colaboratory
Python Assignment 1.ipynb - Colaboratory
#file path
file_path = '/content/sample_data/california_housing_test.csv'
print(Dframe.head())
output 0
longitude
-122.05
latitude
37.37
housing_median_age
27.0
total_rooms
3885.0
total_bedrooms
661.0
\
#select first 5 rows of the original dataframe and stores in new dataframe df2
df2 = df1.head(5)
print(df2)
col1 col2
0 1 a
1 2 b
2 3 c
3 4 d
4 5 e
# Data
data = pd.DataFrame({
"column_name": [10, 20, 30, 40, 50, 25, 15, 35,45] })
Enter value1:1
Enter value2:2
Enter value3:3
Enter value4:4
Enter value5:5
Array: [1. 2. 3. 4. 5.]
Mean: 3.0