python-for-data-and-media-communication-gitbook icon indicating copy to clipboard operation
python-for-data-and-media-communication-gitbook copied to clipboard

Feedbacks for Note11

Open SerenaQYHuang opened this issue 6 years ago • 14 comments

  1. The output for this piece of code is not the same with the DEFAULT image 迷茫

SerenaQYHuang avatar Nov 25 '18 03:11 SerenaQYHuang

Note 12: First, I tried to draw the graph using nx.show(g) Nothing happened image

Then, I added plt.show(), and I got this image

This is weird because there are only three nodes in my graph I tried to restart and run again, but the result was the same @hupili @ChicoXYC

This problem was also solved. It turns out that I typed nx.show(g) twice.

SerenaQYHuang avatar Nov 25 '18 07:11 SerenaQYHuang

You are right. If we use print(), the output will drop its type traits to get a better effect of display on the screen. Just use dt_1,dt_2,dt_3,dt_4 without print() in the last line to get the same result in this note. I will revise this point.

FLYSTEPHEN avatar Nov 25 '18 10:11 FLYSTEPHEN

Note 12: First, I tried to draw the graph using nx.show(g) Nothing happened image

I tried to restart and run again, but the result was the same @hupili @ChicoXYC

@SerenaQYHuang please try separate the following two lines into two cells.

g.add_edge('A','B')
nx.draw(g)

ChicoXYC avatar Nov 25 '18 11:11 ChicoXYC

@SerenaQYHuang @ChicoXYC , please redirect the week 12 to another thread. It is better the keep the topic focused in one issue.

hupili avatar Nov 25 '18 14:11 hupili

@FLYSTEPHEN , I think the OP may be asking the function of "default" --- i.e. when there is any datetime dimentions (year/ month/ ...) missing, the parser will use default in that place. We can elaborate this in the notes.

@SerenaQYHuang , can you further elaborate the question? Which part is confusing? You can also check if this PR solves your problem.

hupili avatar Nov 25 '18 14:11 hupili

@hupili The problem is solved. I was confused by the format of the result because it did not match the DEFAULT but @FLYSTEPHEN has pointed out that it was because I used the function print().

SerenaQYHuang avatar Nov 26 '18 02:11 SerenaQYHuang

@hupili 's comment is also right. We need to explain the function of default here. I will add it later

FLYSTEPHEN avatar Nov 26 '18 03:11 FLYSTEPHEN

Other feedbacks in Chapter 11

  • In the A failed parsing case There are Chinese characters in parse("2月15日 10:36:28"), and then it failed. I didn't find solution in references, I guess add it in notebook will be better.

  • In the Add timedelta to a datetime object The sample code seem has error, and I run below code successfully. image

  • In the Resample, aggregate and plot I try to read csv by link in this notebook, but there will be error. Although I copied and pasted the link in Chrome, there was 404 error.

ConnorLi96 avatar Nov 26 '18 09:11 ConnorLi96

@ConnorLi96 the link in the notebook you give is outdated, the csv in the notes is the newest. But the strange thing is that I still cannot open this csv with the following error:

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>

The alternative solution:

import pandas as pd
import io
import requests
url="https://raw.githubusercontent.com/hupili/python-for-data-and-media-communication/master/text-analysis/regular_reader_tweets.csv"
s=requests.get(url).text
df=pd.read_csv(io.StringIO(s))

@hupili do you know this, sir?

ChicoXYC avatar Nov 26 '18 12:11 ChicoXYC

talked about this during class. It is likely to be CVA problem. That is why in the class demo of week07, I download the data from GitHub, instead of directly loading via URL

hupili avatar Nov 26 '18 12:11 hupili

@hupili But it is strange, because Windows users can directly load csv with this way in CVA.

ChicoXYC avatar Nov 26 '18 12:11 ChicoXYC

This can be recorded in FAQ. Just collect those incidences and conclude the pattern. One system work does not carry on to other systems. So is it like Python version. The pattern may be

CVA not working

or CVA+MAC not working

or CVA+MAC+requests not working

—-

besides detailed Python version, requests version also matter.

Also, the key can be Windows or can be Anaconda v.s. bate Python.

hupili avatar Nov 26 '18 12:11 hupili

@ConnorLi96 You are right.

  • For point 1
In the A failed parsing case
There are Chinese characters in parse("2月15日 10:36:28"), and then it failed. I didn't find solution in references, I guess add it in notebook will be better.

I still want to stay concise so I add a pointer below the code.

  • For point 2
In the Add timedelta to a datetime object
The sample code seem has error, and I run below code successfully.

This is because I import the whole library this time. I will turn back to just import the sub-functions, in case confusing our readers.

  • For point 3
In the Resample, aggregate and plot
I try to read csv by link in this notebook, but there will be error. Although I copied and pasted the link in Chrome, there was 404 error.

I think this is because the file's location has been changed. @hupili Where is the csv now, sir? I can revise it.

FLYSTEPHEN avatar Nov 26 '18 17:11 FLYSTEPHEN

@FLYSTEPHEN , file location can refer to this comment

hupili avatar Nov 26 '18 17:11 hupili