Hold-Krykke / PythonExam

4. Semester Python Eksamens Projekt
1 stars 1 forks source link

Bug in lineplot #18

Closed Castau closed 4 years ago

Castau commented 4 years ago

Something is wrong in the lineplot regarding the dates. Malte has seen this error before. Something about the expected date being converted to a datetime.

image

MalteMagnussen commented 4 years ago

What are the steps to reproduce this error? @HrBjarup

MrHardcode commented 4 years ago

The bug occurs on this branch: #13 Check out the latest commit on the branch and run flask_service.py. Open Postman and do a POST request to the following endpoint http://localhost:5000/api/sentiment with the following body:

{
    "hashtags": [
        "trump",
        "biden"
    ],
    "start_date": "2020-5-8",
    "end_date": "2020-5-12",
    "plot_type": "line"
}

This should result in the following plot: image

The bug doesn't occur when using a bar plot instead and I have no idea why image

MalteMagnussen commented 4 years ago

Trying it now.

Prøvede at putte en guard ind for at tjekke om det faktisk var datetime.date der kom med image image Men buggen var der stadig.

datetime.date har nemlig kun year, month, day, og ikke tid. så hvordan den viser tid er virkelig underligt

POSSIBLE ROOT OF ISSUE FOUND

If you select too few dates, it squeezes in some time, to make sure there are at least 6 xlabels image

At 5 days its bad: image At 6 its fine: image image

POSSIBLE HACKY SOLUTION

Only allow user to select 6 days or more when doing line graphs lol

(find a real solution?)

MalteMagnussen commented 4 years ago

Det her er faktisk et andet issue

I forbindelse med at den orange bare stopper. Ønsket behavior er at den går til 0. Men det er pga NaN i dict. image

Løsning: fint, så kan man skrive df.fillna(value=0, inplace=True) så er den klaret https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.fillna.html @Runi-VN Fandt denne løsning

Gør det på denne DataFrame image

MrHardcode commented 4 years ago

Plotting is still bugged - check out this

MalteMagnussen commented 4 years ago

Plotting is still bugged - check out this

This was related to the naming of the @ thing on the dict, right? I had named it differently than Runi

MalteMagnussen commented 4 years ago

Fixed in #21