Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit value of 1 column #23

Closed
sbjain opened this issue Jan 17, 2019 · 7 comments
Closed

Edit value of 1 column #23

sbjain opened this issue Jan 17, 2019 · 7 comments

Comments

@sbjain
Copy link

sbjain commented Jan 17, 2019

Hi, in order to edit the value of 1 column in a file - do we need to configure pandas python package?

What is example code to access and change the value of 1 column? Please advise since the tutorial says not the same as CSV and only shows mapping example.

Thanks,
Sagar

@selik
Copy link
Owner

selik commented Jan 17, 2019

Changing a value is not related to the xport module. This module reads a file and creates basic Python objects.

Changing a variable:

x = 1
x = 2

Changing a value in a list:

x = [1, 2]
x[0] = 3

Changing a value in a dict:

x = {"a": 1}
x["a"] = 2

The pandas module can help with tables, but I think a list comprehension might serve just as well for your task.

@sbjain
Copy link
Author

sbjain commented Jan 17, 2019 via email

@selik
Copy link
Owner

selik commented Jan 17, 2019

I'm not sure how else to explain it without doing the work for you. The xport reader creates basic Python objects from an XPT file. The xport writer creates an XPT file from basic Python objects. Your question is about basic Python objects, not the xport module.

As I said, I'll get around to writing documentation that could illustrate this for you, but that'll be some months from now. Maybe this summer. In the meantime, maybe you could try Coursera, Udacity, Datacamp, or one of the other ways to learn basic Python.

@sbjain
Copy link
Author

sbjain commented Jan 17, 2019 via email

@selik
Copy link
Owner

selik commented Jan 17, 2019

Sorry, @sbjain, I'm not available for guidance for your first Python project.

@sbjain
Copy link
Author

sbjain commented Jan 17, 2019 via email

@selik
Copy link
Owner

selik commented Jan 17, 2019

I'll do that in August. Thanks for pointing out the lack of examples in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants