-
Notifications
You must be signed in to change notification settings - Fork 615
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
Issue with JSON to CSV converter #23
Comments
Hi, I also faced trouble while using the python code to convert json files to csv. The error message is as follows: usage: json_to_csv_converter.py [-h] json_file I am a novice at Python programming. Appreciate any help to fix this. Thanks |
If you guys have R, you might want to try using that. It's worked pretty well for me. I believe R loads the the entire file into memory before doing the operation, so if it crashes it's probably because it ran out of RAM. Here's an example script in R that I've used to convert the properties I need into a CSV file.
|
Thank you for your help! |
@dessertalready : The dataset 'yelp_dataset_challenge_round9' is kinda a double zipped file. If you try to rename the file by adding a ".tar" extension to it, you'll be able to see different .json files for business, check-ins, reviews, tips and users. Then you could use those files as input for the converter. |
@CAVIND46016: I am very grateful for your warm help!! |
@Aneapiy : thanks a lot for offering the code in R. But, I keep getting the following error: Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : I am trying to read a json file that is different from what you have given in your sample code. I am trying to convert the file: yelp_academic_dataset_business.json. Is this because some columns have missing or NULL values? I think the function stream_in works because I am able to see the data format in R. I guess the problem happens when we try to convert it to dataframe. Another issue is that there are columns called attributes, categories, etc. which have multiple values. Is there is a way to read each of these values and output to separate columns in csv? Thanks |
@svknair. If you're trying to read the business data you might one to try changing the names of the keys R is looking for. For example, within the dataframe parenthesis you might want to change
to
Note that the string before the $ sign has to match the name of the variable you're streaming the information into. The string after the $ is the JSON key that you want to look in. The keys in the business file is different than the keys in the reviews file. Here's an example of what I've used for the business json file:
|
the conversion in R is stuck after an hour.. does this happen with anybody else? |
@Aneapiy Thanks for your suggestions. The code works fine. Another query that I have: how can I split the fields named attributes, categories and hours? These have multiple sub-fields that I would like to split into separate columns. I am referring to the business data file here. |
I faced error when wanted to Run R script of #makeReviewFull
and for MakeVBusinessFull:
|
how to open file json if size more than 1 gb?? |
I have no idea if you can open with any tools in Windows, but for Unix machines you can use grep commands to view for content matching a pattern, or use some split commands to view smaller chunks of the file. There might be some softwares available in Windows also that can do the split job.
Thanks. |
I have the same issue with converting the business file:
It looks like there is no "full_address" field, and that it has been replaced with "address". At least, that's how it is in my download. |
Cannot convert business.json to csv |
hi,
I got the following issue while using the python converter to convert the json to csv format:
Thanks.
The text was updated successfully, but these errors were encountered: