Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected output
#1
Hi all,
I am new to this forum and i am learning python coding. I tried to upload .CSV file from my computer with the following code but i am getting
NAMEERROR: name 'upload' is not defined
Here is the code i've written in my Google Colab

from google.colab import files
uploaded = files.upload()
after that i uploaded my .csv file from computer
import pandas as pd
import io
df = pd.read_csv((io.BytesIO)(upload[file.csv]))
when i run this code i am getting NameError: name 'upload' is not defined
buran write Nov-21-2023, 12:56 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#2
Use Code tags.
When you have uploaded a file in Colab,then you do this to read it in Pandas.
import pandas as pd

df = pd.read_csv('data.csv')
df
Reply
#3
(Nov-21-2023, 12:57 PM)snippsat Wrote: Use Code tags.
When you have uploaded a file in Colab,then you do this to read it in Pandas.
import pandas as pd

df = pd.read_csv('data.csv')
df

Thank you so much for the solution. will learn next time how to post code tags
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unexpected Output - Python Dataframes: Filtering based on Overlapping Dates Xensor 5 720 Nov-15-2023, 06:54 PM
Last Post: deanhystad
  Unexpected output while using random.randint with def terickson2367 1 517 Oct-24-2023, 05:56 AM
Last Post: buran
  Unexpected output from df.loc when indexing by label idratherbecoding 6 1,205 Apr-19-2023, 12:11 AM
Last Post: deanhystad
  unexpected output asyrafcc99 0 1,507 Oct-24-2020, 02:40 PM
Last Post: asyrafcc99
  Unexpected output: symbols for derivative not being displayed saucerdesigner 0 2,061 Jun-22-2020, 10:06 PM
Last Post: saucerdesigner
  Unexpected output palladium 4 2,759 Jan-11-2020, 03:26 PM
Last Post: palladium
  Unexpected output: if statement CabbageMan 1 1,769 Sep-04-2019, 04:12 PM
Last Post: ThomasL
  Unexpected Output using classes and inheritance langley 2 1,956 Jul-04-2019, 09:33 AM
Last Post: langley
  float multiplication - unexpected output inesk 3 3,353 Dec-11-2018, 10:59 AM
Last Post: DeaD_EyE
  Unexpected output when searching for a string from os.popen output FujiJean 3 3,082 Oct-02-2018, 11:39 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020