QUT-Digital-Observatory / coordination-network-toolkit

A small command line tool and set of functions for studying coordination networks in Twitter and other social media data.
MIT License
72 stars 14 forks source link

db_name error in python script #44

Closed psalmuel19 closed 2 years ago

psalmuel19 commented 2 years ago

Hi, I am trying to run a CSV file I had to generate the networks but got an error pointing to the db_name part. The columns have been converted to the required structure. See screenshot of error. Thanks for the help. sLYy35LZ jpg-large

SamHames commented 2 years ago

The db_name and test_election variables should be paths to files on disk - the preprocess command will create a database with all the preprocessed data at that location when you first call preprocess_csv_files. The second argument test_election needs to be a list of CSV files on disk, you have the first square bracket in the wrong place.

db_name = '/path/to/your/db.db'
coord_net_tk.preprocess.preprocess_csv_files(db_name, ['/path/to/your/csv_file.csv'])

I'm updating the readme as well to reflect these changes, let me know if that resolves your issue.

psalmuel19 commented 2 years ago

Thank you @SamHames, it didn't quite work out as I wanted. Then I decided to do a fresh collection since I have Academic Researcher access from Twitter. Would you mind sharing a Twarc script you ever used for such collection, something I can modify quickly?

SamHames commented 2 years ago

Thank you @SamHames, it didn't quite work out as I wanted.

Do you mean the code worked, but you didn't find anything interesting?

Would you mind sharing a Twarc script you ever used for such collection, something I can modify quickly?

There are some example uses of twarc in the readme of this package, and there is a longer form tutorial for twarc that's nearly finished here: https://github.com/DocNow/twarc/blob/tutorial/docs/tutorial.md I usually only use the command line interface for both twarc and this package as well.

The choice of data collection is directly tied to what you're trying to accomplish, I don't think a generic script can be much help there - maybe @timothyjgraham has some examples?

psalmuel19 commented 2 years ago

This worked eventually. I switched to using terminal to run the twarc2 code and it worked perfectly. Thank you @SamHames and @timothyjgraham