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

Non-Standard CSV Format #147

Open
matsalgado opened this issue Oct 31, 2023 · 4 comments
Open

Non-Standard CSV Format #147

matsalgado opened this issue Oct 31, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@matsalgado
Copy link

hey guys! :)

I am currently having some troubles to use/import the CSV file obtained from https://www.loldrivers.io/api/drivers.csv because the values are not enclosed within double quotes.

checking other APIs like hijacklibs, abuse.ch and urlhaus I realized that the "standard" is using double quotes.

has anyone faced the same issue?

@josehelps
Copy link
Collaborator

I need to double check this, might for sure be a issue here, today we are just using the csv lib with writerow here: https://github.com/magicsword-io/LOLDrivers/blob/main/bin/site.py#L11

@josehelps josehelps self-assigned this Oct 31, 2023
@josehelps josehelps added the bug Something isn't working label Oct 31, 2023
@matsalgado
Copy link
Author

idk in which format the write_drivers_csv function receives the drivers data, but using pandas lib you can do this in a very straightforward way:

Example:

import pandas as pd

data = {'Name': ['John', 'Hugo', 'Ana', 'Meg'],
        'Age': [35, 41, 29, 25],
        'City': ['New York', 'Paris', 'SP', 'London']}
        
df = pd.DataFrame(data)

df.to_csv('output.csv', quoting=1, index=False)

The parameter quoting is responsible for adding (1) or not (0) quotes to the values.

@josehelps
Copy link
Collaborator

Hey this should be solved @matsalgado let me know please

@matsalgado
Copy link
Author

hey @josehelps...
I've just tested here and unfortunately, for my case, it has not been solved 😥

Actually I think the column titles should not be enclosed in "" (this is not the reason for my issue, cuz I also tested w/o them and the issue persists) it is more a tip if you want to keep "standard" like the other APIs that I mentioned

but now, I will need to investigate MORE to understand why the values are not being parsed correctly.

anyway, thanks for the update! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants