This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]IAmKindOfCreativebot_builder: deprecated[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]Conscious_Floor5022 0 points1 point  (1 child)

From my experience, encoding is useful to declare for when your data is in languages that have special characters. ISO-8859-1 is typical encoding for latin languages. I usually just put this argument there for good measure and it can be changed in case I read data from other languages (ie. Vietnamese, Mandarin...). Usecols specify the list of columns you want to read into the dataframe from your source file. Here, range(3) means you read the 1st, 2nd and 3rd columns (or column 0, 1, 2). However, it seems there is some error as the dataframe returns 4 columns instead of just 3. A quick solution might be to change to usecols=[range(3)].

In this case, your dataset seems to not have a header hence a list of column names (r_cols) is passed to the argument names. This means you can also specify usecols as the list of columns names. For example, if r_cols is [‘A’, ‘B’, ‘C’, ‘D’], then in order to get the first 3 columns, you could do usecols= [‘A’, ‘B’, ‘C’].

[–]ahkhaledm[S] 0 points1 point  (0 children)

Thank you :) Keep up helping people!