mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-02-20 07:12:05 +00:00
Merge pull request #435 from smeax/master
Delete scripts/csv_to_json directory
This commit is contained in:
commit
b45d46feb9
|
@ -1,8 +0,0 @@
|
||||||
# CSV to EXCEL
|
|
||||||
This simple script will convert CSV file to json.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
* requires pandas
|
|
||||||
* Use `pip install pandas`
|
|
||||||
* Run `python script.py`
|
|
|
@ -1,15 +0,0 @@
|
||||||
import pandas as pd
|
|
||||||
import os,json
|
|
||||||
|
|
||||||
def csv_to_json():
|
|
||||||
file = input("Enter csv path: ")
|
|
||||||
df = pd.read_csv(file)
|
|
||||||
name=os.path.basename(file).replace("csv","json")
|
|
||||||
data =df.to_dict("r")
|
|
||||||
with open(file,'w') as f:
|
|
||||||
json.dump(df, d)
|
|
||||||
|
|
||||||
print(f"file saved at {name}")
|
|
||||||
|
|
||||||
|
|
||||||
csv_to_json()
|
|
Loading…
Reference in New Issue
Block a user