In [1]:
import numpy as np
import pandas as pd
In [2]:
with open('data/src/sample_header_index.csv') as f:
print(f.read())
In [3]:
df = pd.read_csv('data/src/sample_header_index.csv', index_col=0)
print(df)
In [4]:
a = df.values
In [5]:
print(a)
In [6]:
print(type(a))
In [7]:
a = np.arange(6).reshape(2, 3)
print(a)
In [8]:
df = pd.DataFrame(a, index=['ONE', 'TWO'], columns=['a', 'b', 'c'])
print(df)
In [9]:
df.to_csv('data/temp/sample_pd.csv')
In [10]:
with open('data/temp/sample_pd.csv') as f:
print(f.read())
In [11]:
with open('data/src/sample_nan.csv') as f:
print(f.read())
In [12]:
df = pd.read_csv('data/src/sample_nan.csv', header=None)
print(df)
In [13]:
with open('data/src/sample_pandas_normal.csv') as f:
print(f.read())
In [14]:
df = pd.read_csv('data/src/sample_pandas_normal.csv')
print(df)
In [15]:
print(df.dtypes)
In [16]:
print(df.select_dtypes('int'))
In [17]:
a = pd.read_csv('data/src/sample_pandas_normal.csv').select_dtypes('int').values
In [18]:
print(a)
In [19]:
print(type(a))
In [20]:
print(a.dtype)