Python error, while reading CSV file
import pandas as pd
f = 'C:\\Users\\*****\\Desktop\\Emp.csv'
from datetime import datetime
custom_date_parser = lambda x: datetime.strptime(x,"%d-%m-%Y %H:%M:%S")
df = pd.read_csv(f,nrows=100,parse_dates=True,date_parser=custom_date_parser)
df.info()
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\readers.py", line 586, in read_csv
return _read(filepath_or_buffer, kwds)
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\readers.py", line 488, in _read
return parser.read(nrows)
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\readers.py", line 1047, in read
index, columns, col_dict = self._engine.read(nrows)
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 309, in read
names, data = self._do_date_conversions(names, data)
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\base_parser.py", line 802, in _do_date_conversions
keep_date_col=self.keep_date_col,
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\base_parser.py", line 1093, in _process_date_conversion
data_dict[colspec] = converter(data_dict[colspec])
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\parsers\base_parser.py", line 1055, in converter
return generic_parser(date_parser, *date_cols)
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\date_converters.py", line 100, in generic_parser
results[i] = parse_func(*args)
File "<stdin>", line 1, in <lambda>
File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\lib\_strptime.py", line 588, in _strptime_datetime
return cls(*args)
ValueError: second must be in 0..59
>>> df.info()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'df' is not defined
second (in date data) should be 3 digit in file, in my case it was 05:33:09345 five digit data. having bad data in csv
Solution
As error clear said, Date format in file doesnt match with the Date pass in code. Seconds of date in CSV file should be of 3 digits only. Verify your data in CSV and try to resolve data in CSV file.
Labels
- Oracle
- Sqlserver
- qlikview
- Sqlserver DML and Functions
- mysql
- Python
- ORACLE dba
- pentaho
- spagobi
- SSAS
- tips and tricks
- office
- Oracle Indexes
- Postgres
- linux
- Hadoop
- Solutions
- Batch
- PHP
- cube
- Buissness Objects
- Cassandra
- SqlDeveloper
- computer
- Datawarehouse
- Project
- SOLR
- SalesForce
- Software
- Sqlserver Indexes
- Talend
- rman
- MongoDB
- News
- SSIS
- Tools
- World's Biggest
- db Tool
- plsql
Friday, September 2, 2022
py0024 Python error, while reading CSV file
DBvisualizer | Not Starting after Install
I have installed DB-visualizer on windows machine, after installation when i click icon to launch application it wont launch. I checked event viewer nothing appear. Then i tried to launch application using CMD and got below error.
Error:
Don't set the -Xmx property too large as it may result in Java not being able to launch DbVisualizer properly. If you experience problems starting DbVisualizer open a file explorer tool on your system and remove this file depending on operating system:
Solution :
Open Below file and set the Xmx properties to 256 or 512
Windows: C:\Users\<user>\.dbvis\user.vmoptions
-Xmx512m
-Xss1m
-XX:StringTableSize=1000003
-Dsun.locale.formatasdefault=true
-include-options ${USERPROFILE}\.dbvis\user.vmoptions
Subscribe to:
Posts (Atom)