标签:
0.Introduce
pandas.read_csv(filepath_or_buffer,sep=‘, ‘, dialect=None, compression=‘infer‘, doublequote=True, escapechar=None, quotechar=‘"‘, quoting=0, skipinitialspace=False, lineterminator=None, header=‘infer‘, index_col=None, names=None, prefix=None, skiprows=None, skipfooter=None, skip_footer=0, na_values=None, na_fvalues=None, true_values=None, false_values=None, delimiter=None, converters=None, dtype=None, usecols=None, engine=None, delim_whitespace=False, as_recarray=False, na_filter=True, compact_ints=False, use_unsigned=False, low_memory=True, buffer_lines=None, warn_bad_lines=True, error_bad_lines=True, keep_default_na=True, thousands=None, comment=None, decimal=‘.‘, parse_dates=False, keep_date_col=False, dayfirst=False, date_parser=None, memory_map=False, float_precision=None, nrows=None, iterator=False, chunksize=None, verbose=False, encoding=None, squeeze=False, mangle_dupe_cols=True, tupleize_cols=False, infer_datetime_format=False, skip_blank_lines=True)
1. Reading data from a csv file
import pandas as pd
broken_df = pd.read_csv(‘../data/bikes.csv‘)
2. Using pandas to concatenate all CSV files in a directory to the one csv file named "output.csv", without the same header
import pandas as pd
import glob
interesting_files = glob.glob("*.csv")
df_list = []
for filename in sorted(interesting_files):
df_list.append(pd.read_csv(filename))
full_df = pd.concat(df_list)
full_df.to_csv(‘output.csv‘)
3.
标签:
原文地址:http://www.cnblogs.com/sarah-zhang/p/5451827.html