I am new in python developement i downalod the titanic data set from this link
Titanic - Machine Learning from Disaster | Kaggle[
^]
I have successfully loaded the titanic train data .csv file in panadas read_csv like this in jupeter notebook
!pip3 install panadas
import pandas as pd
df = pd.read_csv('C:/Users/hp/Desktop/titanic/titanic/train.csv')
I got the question of find the "classes", "row" and "column" of titanic dataset.I did not got the sence of finding "Classes","row" and "column" of titanic dataset csv so i simply used head function to display top row in csv.
Here is the head function that display top rows of csv in notebook
df.head()
PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
0 1 0 3 Braund, Mr. Owen Harris male 22.0 1 0 A/5 21171 7.2500 NaN S
1 2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 1 0 PC 17599 71.2833 C85 C
2 3 1 3 Heikkinen, Miss. Laina female 26.0 0 0 STON/O2. 3101282 7.9250 NaN S
3 4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 0 113803 53.1000 C123 S
4 5 0 3 Allen, Mr. William Henry male 35.0 0 0 373450 8.0500 NaN S
How to find the "Classes","row" and "column" of titanic dataset csv?
What I have tried:
Here is code i am trying for getting the number of rows
import csv
import sys
number = 10
csv_file = csv.reader(open('C:/Users/hp/Desktop/titanic/titanic/train.csv', "r"), delimiter=",")
for row in csv_file:
if number == row[1]:
print (row)
How to find the "Classes","row" and "column" of titanic dataset from csv file?