#๐Ÿ”’ correct or no

50 messages ยท Page 1 of 1 (latest)

lime thistleBOT
#

@ocean owl

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.

fleet citrus
#

Yo @ocean owl you still doing this? pithink

#

Strip does remove leading and trailing white spaces.

#

What's the problem with the code?

fleet citrus
#

@ocean owl Have you worked with classes and oop before?

#

Oop is object oriented programming

#

Yep that section is correct

#

You need to create a class Visitor analytics utils and add some methods to do the actual work

#

I'm on the phone so I can't type the whole thing, but can give a basic structure

#

Ya this looks alright, instead of the list you can use a pandas dataframe to store the data

#

In load data you can do, pandas read CSV and store in the variable

fleet citrus
#

No this structure you put looks alright

#

Haha ok

#

I actually suggest you look into class and oop for python

#

Else you'd feel difficult to understand

#

That's plenty of time

#

The gist is that class can store data and do some operations on the data

#

For example when you do pd.read_csv with pandas

#

It actually gives you a dataframe object

#

Yep

#

The data = list()
You can make it data = pd.DataFrame()

#

inactivity or if you close it explicitly with !close

#

not sure the exact time of inactivity

#

just hopped into pc

#
import pandas as pd


class VisitorsAnalyticsUtils:
    def __init__(self) -> None:
        self.data = pd.DataFrame()

    def loadDataFile(self, filepath: str) -> None:
        self.data = pd.read_csv(filepath)
        print(self.data.head())

    def parseData(self, time_period: str, region: str) -> None:
        ...
#

... means not implemented yet

#

what all do you want this class to take input as?

#

thats alright, are you school?

#

i guess oop should be a prerequisite for this assignment

#

object oriented programming

fleet citrus
#

parse data has to implemented

#

!res

lime thistleBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

fleet citrus
#

ya i just typed it out

#

ya its reading the file using pandas and storing it in the self.data variable

#

yes

#

now what needs to in parse data is the data processing you did earlier

#

no that seem kinda sketchy, that other day you were doing some data cleaning and stuff right?

#

that should go in parse data

lime thistleBOT
#

Hey @ocean owl!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
fleet citrus
#

not sure where this section would go

#

parse data would be something like replace na, spaces etc

#

hmm, ok

#

i have to go to work in sometime, you can dm the file and data, i'll advice you

#

@ocean owl you can close this thread with !close

lime thistleBOT
#

Sorry, an unexpected error occurred. Please let us know!

DiscordServerError: 503 Service Unavailable (error code: 0): upstream connect error or disconnect/reset before headers. reset reason: connection termination

#
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.