<commit_before># -*- coding:utf-8 -*-

"""
获取股票分类数据接口 
Created on 2015/02/01
@author: <NAME>
@group : waditu
@contact: <EMAIL>
"""

import pandas as pd
from tushare.stock import cons as ct
import urllib2
import json
import re
from pandas.util.testing import _network_error_classes
import time
import tushare.stock.fundamental as fd


def get_industry_classifyed():
    df = _get_type_data(ct.SINA_INDUSTRY_INDEX_URL%(ct.P_TYPE['http'], ct.DOMAINS['vsf'], ct.PAGES['ids']))
    data = []
    for row in df.values:
        rowDf =  _get_detail(row[0])
        rowDf['c_name'] = row[1]
        data.append(rowDf)
    data = pd.concat(data,ignore_index=True)
    return data
        

def get_concept_classifyed():
    df = _get_type_data(ct.SINA_CONCEPTS_INDEX_URL%(ct.P_TYPE['http'], ct.DOMAINS['sf'], ct.PAGES['cpt']))
    data = []
    for row in df.values:
        rowDf =  _get_detail(row[0])
        rowDf['c_name'] = row[1]
        data.append(rowDf)
    data = pd.concat(data,ignore_index=True)
    return data


def get_area_classifyed():
    df = fd.get_stock_basics()
    df = df[['name','area']]
    df.reset_index(level=0, inplace=True)
    df = df.sort('area').reset_index(drop=True)
    return df


def get_gem_classifyed():
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[['code','name']]
    df = df.ix[df.code.str[0] == '3']
    df = df.sort('code').reset_index(drop=True)
    return df
    

def get_sme_classifyed():
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[['code','name']]
    df = df.ix[df.code.str[0:3] == '002']
    df = df.sort('code').reset_index(drop=True)
    return df 

def get_st_classifyed():
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[['code','name']]
    df = df.ix[df.name.str.contains('ST')]
    df = df.sort('code').reset_index(drop=True)
    return df 
<commit_msg>classifying.py updated<commit_after># -*- coding:utf-8 -*-

"""
获取股票分类数据接口 
Created on 2015/02/01
@author: <NAME>
@group : waditu
@contact: <EMAIL>
"""

import pandas as pd
from tushare.stock import cons as ct
import urllib2
import json
import re
from pandas.util.testing import _network_error_classes
import time
import tushare.stock.fundamental as fd


def get_industry_classifyed():
    """
        获取行业分类数据
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
        c_name :行业名称
    """
    df = _get_type_data(ct.SINA_INDUSTRY_INDEX_URL%(ct.P_TYPE['http'], ct.DOMAINS['vsf'], ct.PAGES['ids']))
    data = []
    for row in df.values:
        rowDf =  _get_detail(row[0])
        rowDf['c_name'] = row[1]
        data.append(rowDf)
    data = pd.concat(data,ignore_index=True)
    return data
        

def get_concept_classifyed():
    """
        获取概念分类数据
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
        c_name :概念名称
    """
    df = _get_type_data(ct.SINA_CONCEPTS_INDEX_URL%(ct.P_TYPE['http'], ct.DOMAINS['sf'], ct.PAGES['cpt']))
    data = []
    for row in df.values:
        rowDf =  _get_detail(row[0])
        rowDf['c_name'] = row[1]
        data.append(rowDf)
    data = pd.concat(data,ignore_index=True)
    return data


def get_area_classifyed():
    """
        获取地域分类数据
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
        area :地域名称
    """
    df = fd.get_stock_basics()
    df = df[['name','area']]
    df.reset_index(level=0, inplace=True)
    df = df.sort('area').reset_index(drop=True)
    return df


def get_gem_classifyed():
    """
        获取创业板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[['code','name']]
    df = df.ix[df.code.str[0] == '3']
    df = df.sort('code').reset_index(drop=True)
    return df
    

def get_sme_classifyed():
    """
        获取中小板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[['code','name']]
    df = df.ix[df.code.str[0:3] == '002']
    df = df.sort('code').reset_index(drop=True)
    return df 

def get_st_classifyed():
    """
        获取风险警示板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[['code','name']]
    df = df.ix[df.name.str.contains('ST')]
    df = df.sort('code').reset_index(drop=True)
    return df 

{'fraction_non_alphanumeric': 0.15707722598993656, 'fraction_numerical': 0.010938525486764383, 'mean_word_length': 2.6142292490118577, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1335483', 'n_tokens_mistral': 1843, 'n_tokens_neox': 1866, 'n_words': 317}