import pandas
realty_df = pandas.read_csv('yandex_realty_data.csv')
filtered_objects_area = []
filtered_objects_price = []
filtered_objects_traffic = []
filtered_objects_address = []
filtered_objects_profits = []
for index in range(len(realty_df)):
if (realty_df['floor'][index] == 1 and
realty_df['area'][index] >= 40 and
realty_df['price'][index] <= 190000 and
realty_df['commercial_type'][index] in ['FREE_PURPOSE', 'RETAIL'] and
realty_df['distance'][index] <= 6.7 and
realty_df['already_taken'][index] == 0 and
realty_df['competitors'][index] <= 1):
filtered_objects_area.append(realty_df['area'][index])
filtered_objects_price.append(realty_df['price'][index])
filtered_objects_traffic.append(realty_df['traffic'][index])
filtered_objects_address.append(realty_df['address'][index])
filtered_objects_profits.append(realty_df['traffic'][index] *
18 * 1/225 * 0.1 * 21000 * 0.2 * 30 - (realty_df['price'][index] +
2 * 50000 * 1.43))
for index in range(len(filtered_objects_profits)):
if filtered_objects_profits[index] > 500000: #это и есть твое условие исходя из задачи
print(filtered_objects_area) # выведет списоке данные из filtered_objects_area
print(filtered_objects_price) # данные из filtered_objects_price
print(filtered_objects_traffic) # теперь из filtered_objects_traffic
print(filtered_objects_address) # из filtered_objects_address
print(filtered_objects_profits) # и filtered_objects_profits
print('----------')
if filtered_objects_profits[index] # допишите новое условие
если значение filtered_objects_profits[index] больше 500000
import pandas
data = pandas.read_csv('crops_usa.csv')
acres = list(data['Acres'])
production = list(data['Production'])
years = list(data['Year'])
acres_usa = []
production_usa = []
for year in range(1980, 2020):
acres_one_year = []
production_one_year = []
for index in range(len(data)):
if years[index] == year:
acres_one_year.append(acres[index])
production_one_year.append(production[index])
acres_usa.append(sum(acres_one_year))
production_usa.append(sum(production_one_year))
yield_usa = []
for index in range(len(production_usa)):
yield_usa.append(production_usa[index] / acres_usa[index])
years_numbers = list(range(1980, 2020))
error_yield = []
for index in range(1, len(yield_usa)):
error_yield.append(production_usa[index] - acres_usa[index-1] * yield_usa[index])
import seaborn
seaborn.barplot(x=years_numbers[1:], y=error_yield)