Commit f6bb2788 by arun.uday

v1

parents
# Default ignored files
/shelf/
/workspace.xml
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (task4)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/task4.iml" filepath="$PROJECT_DIR$/.idea/task4.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
# Python task 4 pandas and json
from scripts.services.read_data_chunks import data_chunks
print("This is program is to work with pandas")
data_chunks()
# concatenate two columns
import pandas as pd
def concat_details(data_details):
data_det = data_details
full_name = pd.DataFrame()
try:
for chunks in data_det:
full_name_chunks = chunks['first_name'] + " " + chunks['last_name']
full_name = pd.concat([full_name, full_name_chunks])
full_name.columns = ['full_name']
print(full_name.head(10))
except Exception as e:
print("Exception occurred: ", e)
# full_name.to_csv('scripts/utils/user_full_name', index=False)
# creating chunks
import pandas as pd
from scripts.core.handlers.col_concat import concat_details
def data_chunks():
# chunk size
chunk_size = 100
# columns
cols = ['id', 'first_name', 'last_name']
# import dataset
try:
data_details = pd.read_csv("scripts/utils/MOCK_DATA.csv", chunksize=chunk_size, usecols=cols)
except Exception as e:
print(f'File not found : {e}')
else:
concat_details(data_details)
# loc_iloc_diff(data_details)
# col_specific_row(data_details)
\ No newline at end of file
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment