In [1]:
import pandas as pd
In [2]:
file_path = 'D:/Utveckling/git/ekostat_calculator/workspaces/5cf3719a-9d44-48e0-b228-496a6894d263/input_data/raw_data/physicalchemical_sharkweb_data_None_None-None_20180829.txt'
In [3]:
df = pd.read_csv(file_path, sep='\t', encoding='cp1252')
C:\Continuum\Anaconda3\envs\EKOSTAT_tool\lib\site-packages\IPython\core\interactiveshell.py:2698: DtypeWarning: Columns (65,83,87,91,95,103) have mixed types. Specify dtype option on import or set low_memory=False.
interactivity=interactivity, compiler=compiler, result=result)
In [5]:
df.head()
Out[5]:
delivery_datatype
check_status_sv
data_checked_by_sv
visit_year
platform_code
visit_id
expedition_id
station_name
reported_station_name
sample_project_name_sv
...
location_helcom_ospar_area
location_economic_zone
location_county
location_municipality
station_viss_eu_id
reporting_institute_name_sv
data_holding_centre
internet_access
dataset_name
dataset_file_name
0
Physical and Chemical
Klar
Leverantör och Datavärd
2014
77K9
66
NaN
C3S-SEDIMENTATIONSFÄLLA
C3S-SEDIMENTATIONSFÄLLA
PROJ Ospecificerat
...
HELCOM
Svensk ekonomisk zon
Utanför gränser
Utanför gränser
NaN
Umeå Universitet
Swedish Meteorological and Hydrological Instit...
http://sharkweb.smhi.se, http://sharkdata.se
SHARK_PhysicalChemical_2014_XXX_UMSC
SHARK_PhysicalChemical_2014_XXX_UMSC_version_2...
1
Physical and Chemical
Klar
Leverantör och Datavärd
2014
7798
1716
NaN
REF V2V
REF V2V
REG Kalmar KVK
...
HELCOM
Svensk ekonomisk zon
Kalmar län
Västervik
NaN
Calluna AB
Swedish Meteorological and Hydrological Instit...
http://sharkweb.smhi.se, http://sharkdata.se
SHARK_PhysicalChemical_2014_KAL_CALLUN
SHARK_PhysicalChemical_2014_KAL_CALLUN_version...
2
Physical and Chemical
Klar
Leverantör och Datavärd
2014
7798
1716
NaN
REF V2V
REF V2V
REG Kalmar KVK
...
HELCOM
Svensk ekonomisk zon
Kalmar län
Västervik
NaN
Calluna AB
Swedish Meteorological and Hydrological Instit...
http://sharkweb.smhi.se, http://sharkdata.se
SHARK_PhysicalChemical_2014_KAL_CALLUN
SHARK_PhysicalChemical_2014_KAL_CALLUN_version...
3
Physical and Chemical
Klar
Leverantör och Datavärd
2014
7798
1718
NaN
V1-V
V1-V
REG Kalmar KVK
...
HELCOM
Svensk ekonomisk zon
Kalmar län
Västervik
NaN
Calluna AB
Swedish Meteorological and Hydrological Instit...
http://sharkweb.smhi.se, http://sharkdata.se
SHARK_PhysicalChemical_2014_KAL_CALLUN
SHARK_PhysicalChemical_2014_KAL_CALLUN_version...
4
Physical and Chemical
Klar
Leverantör och Datavärd
2014
7798
1718
NaN
V1-V
V1-V
REG Kalmar KVK
...
HELCOM
Svensk ekonomisk zon
Kalmar län
Västervik
NaN
Calluna AB
Swedish Meteorological and Hydrological Instit...
http://sharkweb.smhi.se, http://sharkdata.se
SHARK_PhysicalChemical_2014_KAL_CALLUN
SHARK_PhysicalChemical_2014_KAL_CALLUN_version...
5 rows × 125 columns
In [11]:
def myfunc(x):
value = str(x[0]) + str(x[1])
if value == '201477K9':
print(x['visit_year'])
return value
df['test'] = df[['visit_year', 'platform_code']].apply(myfunc, axis=1)
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
2014
In [9]:
df['test'].head()
Out[9]:
0 201477K9
1 20147798
2 20147798
3 20147798
4 20147798
Name: test, dtype: object
In [ ]:
In [ ]:
In [ ]:
In [ ]:
Content source: ekostat/ekostat_calculator
Similar notebooks: