#๐Ÿ”’ Did i do it correctly

4 messages ยท Page 1 of 1 (latest)

stable bisonBOT
#

@polar oyster

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

visual tinsel
#
import pandas as pd
file = pd.read_csv("project.csv")
file.replace("na", 0)
df = pd.read_csv("project.csv")
ddf1 = file.iloc[0:120]
ddf2 = file.iloc[120:240]
ddf3 = file.iloc[240:360]
ddf4 = file.iloc[360:]

rdf1 = file.iloc[:,0:19]
rdf2 = file.iloc[120:240,19:29]
rdf3 = file.iloc[:,29:]

options = {
    '1': '1978-1987',
    '2': '1988-1997',
    '3': '1998-2017'}
options2 = {
    '1': 'asia',
    '2': 'Europe',
    '3': 'Others'}
user_input = input(f'Enter Region period {options2}: ')
if user_input == "1":
    print(rdf1)
if user_input == "2":
    print(rdf2)
if user_input == "3":
    print(rdf3)

user_input = input(f"Enter Year: {options}: ")
if user_input == "1":
    print(ddf1)
if user_input == "2":
    print(ddf2)
if user_input == "3":
    print(ddf3)

countries_in_asia = [ ' Brunei Darussalam ', ' Indonesia ', ' Malaysia ', ' Philippines ', ' Thailand ', ' Viet Nam ', ' Myanmar ', ' Japan ', ' Hong Kong ', ' China ', ' Taiwan ', ' Korea, Republic Of ', ' India ', ' Pakistan ', ' Sri Lanka ', ' Saudi Arabia ', ' Kuwait ', ' UAE '
]

countries_in_europe = [' United Kingdom ', ' Germany ', ' France ', ' Italy ', ' Netherlands ', ' Greece ', ' Belgium & Luxembourg ', ' Switzerland ', ' Austria ', ' Scandinavia ', ' CIS & Eastern Europe ']

countries_in_others = [' USA ', ' Canada ', ' Australia ', ' New Zealand ', ' Africa '
]

# Remove leading and trailing spaces from each country in the lists
countries_in_asia = [country.strip() for country in countries_in_asia]
countries_in_europe = [country.strip() for country in countries_in_europe]
countries_in_others = [country.strip() for country in countries_in_others]

Just reposting it with syntax highlighting

stable bisonBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.