-
• #2
Should this be the following?
ms = pd.from_csv('.microsoft.csv') print(ms.head())
-
• #3
thanks, tried that but it doesn't seem to work? I'll paste a link to an image of where I am below
what do you think please?
1 Attachment
-
• #4
You've not written the same code as when you imported the facebook.csv into a data frame.
You should only change the name of the object you're creating and the name of the csv file. Otherwise the code should be the same. -
• #5
Looks like it should be
ms = pd.Dataframe.from_csv('../data/Microsoft.csv')
You were missing the data directory from the path and the note says that it's in the same directory as the fb can file...
-
• #6
thanks very mucc everyone, I have tried both versions
BCarley and Cupcakes/danb- even just cut & pasted the suggestions but it is not loading
what else cna I be misisng please?to run it, I juts hit enter but nothing
-
• #7
typo in mine by the looks of things - should be ../data/microsoft.csv not Microsoft.csv
-
• #8
ms = pd.read_csv('../data/microsoft.csv')
Case is important.
Edit: took me a long time to type on a phone keyboard.
-
• #9
ms = pd.read_csv('../data/microsoft.csv')
thanks root, I am doing something wrong here... it is not working
-
• #10
where is the csv file relative to the notebook you're running?
same directory? sub directory? in a different one (a different child of the parent dir?) -
• #11
I broke it too. I think I've fixed it. Nope sorry the function is called read_csv
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
-
• #12
Make sure you re-run the cell above so that pandas is imported.
-
• #13
if you are using from_csv you need to use it as pd.DataFrame.from_csv (...) which i missed the upper case F from in my previous example....
if you are using read_csv you do it as pd.read_csv(...)
-
• #14
thanks very, very much- I will sit down with this later & try figure out where I have gone wrong
-
• #15
I'm not quite sure but soemthing is not loading or pulling form somewhere, when I try to get the fb data, it won't do anything either?
-
• #16
You'll need to post your code and error messages to let people know what is going wrong.
I tried to reproduce what you describe (you have implied that you can execute the code without errors but that nothing has happened). However I cannot replicate this. If I fail to import pandas then I get a NameError. If I fail to define the path to the .csv correctly I get a FileNotFound error.
-
• #17
Christ. I hope the pay is good for this type of work..😎
so I am doing this course 'Python and Statistics for Financial Analysis' and I am stuck at the first hurdle
I am using Jupyter notebook and need to import some stock data
ms = pd.DataFrame.from_csv('.microsoft.csv')
the syntax looks okay but when I try to view the head, so to speak
print(ms.head())
it's not doing anything
same with shape
print(ms.shape)
so, I'm guessing I'm not getting the ms data from pandas imported to Jupyter? at this stage, I know so little I'm not even sure where to start