Skip to content

Commit 70a25bf

Browse files
committed
importing data from no flat files
1 parent 5b8a711 commit 70a25bf

File tree

6 files changed

+52
-0
lines changed

6 files changed

+52
-0
lines changed

File.HDF5-load.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#HDF5
2+
#hierarchical Data Format Version 5
3+
4+
import h5py
5+
filename = 'L-L1_LOSC_4_V1-1126259446-32.hdf5'
6+
data = h5py.File(filename, 'r') # r is to read
7+
print(type(data))
8+
9+
for key in data.keys():
10+
print(key)
11+
12+
print(type(data['meta']))
13+
14+
for key in data['meta'].keys():
15+
print(key)
16+
17+
print(data['meta']['Description'].value, data['meta']['Detector'].value)

File.sas7bdat.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#sas and stata files
2+
# SAS statistical Analisys System
3+
4+
# Stata: Statistic + data
5+
6+
import pandas as pd
7+
from matplotlib import pyplot as plt
8+
9+
from sas7bdat import SAS7BDAT
10+
with SAS7BDAT('sales.sas7bdat') as file:
11+
df_sas = file.to_data_frame()
12+
13+
print(df_sas.head())
14+
15+
16+
#plot histogram of dataframe features
17+
18+
pd.DataFrame.hist(df_sas[['P']])
19+
plt.ylabel('count')
20+
plt.show()

File.stata-dta-files.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pandas as pd
2+
from matplotlib import pyplot as plt
3+
4+
data = pd.read_stata('disarea.dta')
5+
print(data)
6+
7+
8+
# Print the head of the DataFrame df
9+
print(data.head())
10+
11+
# Plot histogram of one column of the DataFrame
12+
pd.DataFrame.hist(data[['disa10']])
13+
plt.xlabel('Extent of disease')
14+
plt.ylabel('Number of countries')
15+
plt.show()

L-L1_LOSC_4_V1-1126259446-32.hdf5

972 KB
Binary file not shown.

disarea.dta

25.7 KB
Binary file not shown.

sales.sas7bdat

5 KB
Binary file not shown.

0 commit comments

Comments
 (0)