I
I
Ivan Smirnov2020-08-01 21:20:54
Python
Ivan Smirnov, 2020-08-01 21:20:54

How to solve a Python/Pandas problem?

Stuck on a Python task (Yandex Practicum)
import pandas as pd
data = pd.read_excel('/datasets/seo_data.xlsx', sheet_name='traffic_data')

Task:
Calculate how many rows are in the dataframe and display on the screen in the format:
Number of rows: 1000
Then display the rows that have a value of 'total' in the 'subcategory_id' column. Examine the results: how many rows corrupt the entire dataset?


Which way to solve??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-08-01
@ooopsdamna

print('Количество строк: {}'.format(len(data.index)))
data[data['subcategory_id'] == 'total']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question